Update command when using SqlDataSource control in combination with ASP.NET GridView control

Update command when using SqlDataSource control in combination with ASP.NET GridView control

Postby jordan » Tue 28 Mar 2006 08:15

Does anyone know how to format an Update command in an ASP.NET SqlDataSource control when using it with a GridView control?

I have done it before with SqlServer, but i cannot get it to work with MySql.

This is what i have done:

AutoGenerateColumns="False" AutoGenerateDeleteButton="True" AutoGenerateEditButton="True"
DataKeyNames="bstid" DataSourceID="SqlDataSource1" EnableSortingAndPagingCallbacks="True"
PageSize="20">












EnableCaching="True" ProviderName="<%$ ConnectionStrings:mijnConnectionString.ProviderName %>"
SelectCommand="SELECT bstid, bstnam, bstgsl, bstadr, bsthnr, bstpcd, bstplt, bsttel FROM bestel"
UpdateCommand="UPDATE bestel SET bstnam = @bstnam, bstgsl = @bstgsl, bstadr = @bstadr, bsthnr = @bsthnr, bstpcd = @bstpcd, bstplt = @bstplt, bsttel = @bsttel WHERE bstid = @bstid;">


In SqlServer this should work fine. Does anyone know how i can get it to work with the MySQLDirect.NET provider ?
jordan
 
Posts: 7
Joined: Tue 28 Mar 2006 08:05

Postby Alexey » Tue 28 Mar 2006 10:13

You can do it as foollows:
Code: Select all
"
EnableCaching="True" SelectCommand="SELECT bstid, bstnam, bstgsl, bstadr, bsthnr, bstpcd, bstplt, bsttel FROM bestel" ProviderName="<%$ ConnectionStrings:mijnConnectionString.ProviderName %>" UpdateCommand="UPDATE bestel SET bstnam = ?, bstgsl = ?, bstadr = ?, bsthnr = ?, bstpcd = ?, bstplt = ?, bsttel = ? WHERE bstid = ?">
   
       
       
       
       
       
       
       
       
   



This snippet was generated by "Configure Data Source..." wizard for SqlDataSource1 component. If you use it, on the second wizard window press "Advanced..." button and tick appropriate check box.
Alexey
 
Posts: 2756
Joined: Mon 13 Mar 2006 07:43


Return to dotConnect for MySQL