11
Reply

Cannot seem to update a GridView (with Datasource).

Anthony Timmers

Anthony Timmers

May 25 2014 6:12 AM
1k
I think I have made mistakes in the UpdateCommand so I'll post it here:

[code]<asp:SqlDataSource ID="LessenDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:LessenConnection %>" SelectCommand="SELECT * FROM [Lessen]" UpdateCommand="UPDATE Lessen SET Titel = @Titel, Aanvang = @Aanvang, Einde = @Einde, GroepId = @GroepId, ZaalId = @ZaalId, DocentId = @DocentId WHERE (Id = @Id)"></asp:SqlDataSource>[/code]
 
Titel = nvarchar, Aanvang = DateTime, Einde = DateTime, GroepId = int, ZaalId = int, DocentId = int
 
When I try to edit a field I get the following error:
 
 

The conversion of a nvarchar data type to a datetime data type resulted in an out-of-range value.
The statement has been terminated.

 
https://www.dropbox.com/s/wrw6a2d7cro8s9q/GridView.bmp (Image of how the GridView looks) 

Answers (11)