Page 1 of 1

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

Posted: Tue 28 Mar 2006 08:15
by jordan
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:














"
EnableCaching="True" 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 ?

Posted: Tue 28 Mar 2006 10:13
by Alexey
You can do it as foollows:

Code: Select all

"
EnableCaching="True" SelectCommand="SELECT bstid, bstnam, bstgsl, bstadr, bsthnr, bstpcd, bstplt, bsttel FROM bestel" 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.