![]() |
| ||
| Update from Asp.net to Sql server db ...hope some body can help me resolve the problem....where i have to update a particular data , the datas are retreived from the db using a dropdownlist,selected data are updated inside a textbox........... .....where there are constraints set by validators for space and !^#$%&*^----charaecters: My problm is data is not updated,please help me Code:(Asp.net C#---Sql server db) private void btedit_Click(object sender, System.EventArgs e) ..please suggest a soln.......... ICHU |
| ||
| Re: Update from Asp.net to Sql server db Change your query to be set to a string and break the debugger in there. Your drop down list might have an empty string value which would cause the update to not work. You are also not closing your SQL connection and you will run the connection pool out of available connections if your site has many users. private void btedit_Click(object sender, System.EventArgs e) Try something like that and see if you get an exception. That should get you pointed in the right direction. |
| ||
| Re: Update from Asp.net to Sql server db try debugging the code.perhaps the empty values are passed in the query |
| ||
| Re: Update from Asp.net to Sql server db :'( ..Still not working .....Im using 2 radio buttons one to add and nther to edit if i switch from one button to another,the datas are not gettng inserted to sql db ......the same the case as edit.... errors still........ ICHU |
| ||
| Re: Update from Asp.net to Sql server db add a watch in the values at this point SqlCommand cmd=new SqlCommand("Update Loc_mast Set Loc =('"+ txtrnme.Text+"') Where Loc =('"+ Droploc.SelectedItem.Text+"')",con1); |
| ||
| Re: Update from Asp.net to Sql server db Could you please post the table structure of Loc_mast? |
| ||
| Re: Update from Asp.net to Sql server db Quote:
Colname Datatype length Slno int 4(generated automatically-(*identity) Loc_no nvarchar 50 ICHU |
| ||
| Re: Update from Asp.net to Sql server db Use Slno for update operation rather than loc_no. Where clause shoud be Where Slno =('"+ Droploc.SelectedItem.Value+"')",con1)When you bind text properties of dropdown list must bind also Value properties by Slno. |
| ||
| Re: Update from Asp.net to Sql server db Quote:
"...updates only the first record in db" :( |
| ||
| Re: Update from Asp.net to Sql server db Please post your bind code & the qurey that you use to update. |
| All times are GMT -4. The time now is 6:52 pm. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC