Updating gridview with SqlDataSource in asp.net

后端 未结 2 577
滥情空心
滥情空心 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:51

    Found the solution: The Select Columns and the Update Parameters should match in order to update using SqlDataSource, that means if you select(query or procedure) is returning 3 fields in gridview, then all of them should be the parameter for the update, you can miss out the actual updations in database if not required, but the should have all the fields: say for example if below is my select query

    SELECT USERNAME, MOBILENUMBER, EMAIL FROM USERS
    

    then the update parameters should be

    
       
       
       
    
    

    you cannot skip any of the parameters, even though you do not intend to update that field Hope this will help others, as i wasted lots of time researching on this.

提交回复
热议问题