I've set up a basic rad grid using an sqldatasource object. I've specified the parameters and commands to be used:
I've got both the insert and delete commands working correctly. The problem is with the edit.
If anyone could tell me how to get this working, it would be much appreciated
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="Data Source=MACHOINE1;Initial Catalog=myDB;Persist Security Info=True;User ID=user;Password=password" | |
ProviderName="System.Data.SqlClient" SelectCommand="SELECT * FROM [JobCodes]" ConflictDetection="CompareAllValues" | |
DeleteCommand="DELETE FROM [JobCodes] WHERE [JobCodeId] = @original_JobCodeId" | |
InsertCommand="INSERT INTO [JobCodes] ([JobId], [CodeId], [QuantityRequired], [QuantityCompleted], [Comment]) VALUES (@JobId, @CodeId, @QuantityRequired, @QuantityCompleted, @Comment)" OldValuesParameterFormatString="original_{0}" | |
UpdateCommand="UPDATE [JobCodes] SET [JobId] = @JobId, [CodeId] = @CodeId, [QuantityRequired] = @QuantityRequired, [QuantityCompleted] = @QuantityCompleted, [Comment] = @Comment WHERE [JobCodeId] = @original_JobCodeId AND [JobId] = @original_JobId AND [CodeId] = @original_CodeId AND [QuantityRequired] = @original_QuantityRequired AND [QuantityCompleted] = @original_QuantityCompleted AND [Comment] = @original_Comment"> | |
<DeleteParameters> | |
<asp:Parameter Name="original_JobCodeId" Type="Int32" /> | |
</DeleteParameters> | |
<UpdateParameters> | |
<asp:Parameter Name="JobId" Type="Int32" /> | |
<asp:Parameter Name="CodeId" Type="Int32" /> | |
<asp:Parameter Name="QuantityRequired" Type="Decimal" /> | |
<asp:Parameter Name="QuantityCompleted" Type="Decimal" /> | |
<asp:Parameter Name="Comment" Type="String" /> | |
<asp:Parameter Name="original_JobCodeId" Type="Int32" /> | |
<asp:Parameter Name="original_JobId" Type="Int32" /> | |
<asp:Parameter Name="original_CodeId" Type="Int32" /> | |
<asp:Parameter Name="original_QuantityRequired" Type="Decimal" /> | |
<asp:Parameter Name="original_QuantityCompleted" Type="Decimal" /> | |
<asp:Parameter Name="original_Comment" Type="String" /> | |
</UpdateParameters> | |
<InsertParameters> | |
<asp:Parameter Name="JobId" Type="Int32" /> | |
<asp:Parameter Name="CodeId" Type="Int32" /> | |
<asp:Parameter Name="QuantityRequired" Type="Decimal" /> | |
<asp:Parameter Name="QuantityCompleted" Type="Decimal" /> | |
<asp:Parameter Name="Comment" Type="String" /> | |
</InsertParameters> | |
</asp:SqlDataSource> |
I've got both the insert and delete commands working correctly. The problem is with the edit.
When ever I try to save one of the rows i edit i get an sql exception of:
"The data types text and nvarchar are incompatible in the equal to operator".
The comment field is set to be of type text in the database. I googled and found some suggestions on trying to set the db type to be nvarchar(MAX) but this didnt help.If anyone could tell me how to get this working, it would be much appreciated