C sqldatasource updating
To String(); using (Sql Connection sql Conn = new Sql Connection(connection string here);) var command = new Ole Db Command("UPDATE Users SET first_name = ?
With doing it the way I want it (Sql Data Source) it keeps updating the column to "@firstname" rather than the actual value. Also, I am passing the code to a separate class just like you said.
So I am having an issue with doing an update in a Gridview during an On Row Updating event.
What I am trying to do is set the Update Command in an Sql Data Source then update using that command.
Command Text = @"UPDATE Users SET first_name = @firstname WHERE ID = @id"; sql Comm.
To String()); Sql Command sql Comm = new Sql Command(); sql Comm.
I can't seem to get the value of the dropdown lists so I can update the paramaters before the SQL command is executed. BTW: The Session["Column ID"] is being retrieved perfectly as it states 44 in the stack trace string query = "UPDATE Users SET first_name = @firstname WHERE ID = @id"; update User DS. Add With Value("@firstname", first_name); update User DS. Update(); It works perfectly and updates my table, so I am guessing its something to do with how I have binded the query, does anyone realise anything where I have gone wrong? " Select Command="SELECT [fname], [lname], [address], [city], [state], [zip], [phone Num], [auto Carrier], [policy Num], [accountid] ,[User Id] FROM [User Profile] WHERE ([User Id] = @User Id)" On Selecting="User Profile Data Source_Selecting" On Updating="On Sql Updating" Update Command="UPDATE User Profile SET state Id = @state Id, carrier Id = @carrier Id, fname = @fname, lname= @lname, address = @address, city = @city, state = @state, zip = @zip, phone Num = @phone Num, auto Carrier = @auto Carrier, policy Num = @policy Num WHERE ([User Id] = @User Id)"Thanks Mohammad. To be clear though, I already had an on Updating call. Also any insight on how to assign values to the drop down list on Page Load?string query = "UPDATE Users SET first_name = '@firstname' WHERE ID = @id"; update User DS.