Updating gridview with SqlDataSource in asp.net

后端 未结 2 545
滥情空心
滥情空心 2021-01-14 21:14

i want to update the records from the gridview using SqlDataSource, here is what i am doing.
below is my gridview markup



        
2条回答
  •  遥遥无期
    2021-01-14 21:49

    I dont think your solution is OK, since I have to use the atribute OldValuesParameterFormatString="original_{0}" that means that I would have doble parameters, the ones with the original values and the ones with edited values. So there is no way to match the order.

    I have 4 parameters, Im getting the right values for 2 of them, an null at the others.

    I tried your solution and did not work. Thanks anyway.

    Read this: The order of the parameters in the UpdateParameters collection might be important, depending on the ADO.NET provider. The System.Data.OleDb and System.Data.Odbc providers associate the parameters in the collection according to the order that the parameters appear in the parameterized SQL query. The System.Data.SqlClient provider, which is the default ADO.NET provider for the SqlDataSource control, associates the parameters in the collection by matching the name of the parameter with a placeholder alias in the SQL query. For more information about parameterized SQL queries and commands, see Using Parameters with the SqlDataSource Control.

    http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.sqldatasource.updateparameters(v=vs.110).aspx

提交回复
热议问题