c# - program not updating database -


im trying create form allows users edit value in database. code below runs without error however

this calling method

private void btnsavepool_click(object sender, eventargs e)     {         rwcstattracker.database.clsdb.editpool(txteditpool.text, cmbbxsearchpool.selecteditem.tostring());         cmbbxsearchpool.text = "please select pool....";          messagebox.show("pool edited", "alert");         this.frmeditpool_load(this, null);         pnleditpoolsearch.show();     } 

this code in database connection class

public static void editpool(string oldname, string newname)     {         string updtstmt = "update tbl_pool set name = @newname name = @oldname";         sqlconnection conn = getconnection();         sqlcommand updtcmd = new sqlcommand(updtstmt, conn);         updtcmd.parameters.addwithvalue("@newname", newname);         updtcmd.parameters.addwithvalue("@oldname", oldname);          try { conn.open(); updtcmd.executenonquery(); }         catch (sqlexception ex) { throw ex; }         { conn.close(); }     } 

any ideas why it's not updating?

most clause isn't selecting records.

it may have spaces: "smith " not match "smith" or may case sensitive: "smith" not match "smith".

check data see if has spaces , string trim parameters.


Comments

Popular posts from this blog

jquery - How do you format the date used in the popover widget title of FullCalendar? -

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -