Hello!
I've used "Business Grid demo" to build my own sample app from.
I have a setup with main table, .persons (access db) containing names and ID for their workingplace and a table, .workingplace containing the names of the workingplace.
When i try to update the form a get an OleDbException error. "Data type mismatch in criteria expression".
I have been trying for days to solve this probably easy error but without any luck. Hope somebody can help me out here.
I'm running the app with ASP.NET-version:2.0.50727.3053 and Telerik RadGrid.Net2.dll ver 5.0.1.0
Regards
Janne P
Here's my code:
The Grid:
<
radG:RadGrid ID="DetailsGrid" runat="server" AutoGenerateColumns="False" GridLines="None" DataSourceID="ds_details" EnableAJAXLoadingTemplate="True" LoadingTemplateTransparency="15" ShowHeader="False" AllowAutomaticUpdates="True" AllowAutomaticInserts="True" EnableAJAX="True" OnItemInserted="DetailsGrid_ItemInserted" OnItemUpdated="DetailsGrid_ItemUpdated" OnPreRender="DetailsGrid_PreRender" OnCancelCommand="DetailsGrid_CancelCommand" OnItemCreated="DetailsGrid_ItemCreated" OnInsertCommand="DetailsGrid_InsertCommand" Width="464px" Style="overflow: hidden;">
<MasterTableView DataSourceID="ds_details" DataKeyNames="fldInstId" Width="219px">
<Columns>
<radG:GridBoundColumn DataField="fldIdNr" HeaderText="IdNr" UniqueName="fldIdNr" ColumnEditorID="TextEditor" />
<radG:GridBoundColumn DataField="fldFnamn" HeaderText="Förnamn" UniqueName="fldFnamn" ColumnEditorID="TextEditor" />
<radG:GridBoundColumn DataField="fldEnamn" HeaderText="Efternamn" UniqueName="fldEnamn" ColumnEditorID="TextEditor" />
<radG:GridDropDownColumn DataField="fldInstId" ListTextField="fldNamn" ListValueField="fldIdNr"ColumnEditorID="DropDownEditor1" DataSourceID="ds_arbetsplats" HeaderText="Arbetsplats" UniqueName="fldInstId" DataType="System.Int32" />
<radG:GridBoundColumn DataField="fldTitle" HeaderText="Titel" UniqueName="fldTitle" ColumnEditorID="TextEditor"/>
</Columns>
</MasterTableView>
</radG:RadGrid>
The data source for the grid:
<
asp:SqlDataSource ID="ds_details" runat="server"
ConnectionString="<%$ ConnectionStrings:conn_clients %>"
DeleteCommand="DELETE FROM [tblDr] WHERE [fldIdNr] = ?" InsertCommand="INSERT INTO [tdlDr] ([fldFnamn], [fldEnamn]) VALUES (?, ?)" ProviderName="<%$ ConnectionStrings:conn_clients.ProviderName %>" SelectCommand="SELECT fldIdNr, fldFnamn, fldEnamn, fldInstId, fldTitle FROM tblDr WHERE (fldIdNr = ?)"
UpdateCommand="UPDATE tblDr SET fldFnamn = ?, fldEnamn = ?, fldInstId = ?, fldTitle = ? WHERE (fldIdNr = ?)">
<SelectParameters>
<asp:ControlParameter ControlID="BusinessGrid" DefaultValue="" Name="fldIdNr" PropertyName="SelectedValue" Type="Int32" />
</SelectParameters>
<UpdateParameters>
<asp:Parameter Name="fldFnamn" Type="String" />
<asp:Parameter Name="fldEnamn" Type="String" />
<asp:Parameter Name="fldInstId" Type="Int16" />
<asp:Parameter Name="fldTitle" Type="String" />
</UpdateParameters>
<InsertParameters>
<asp:Parameter Name="fldFnamn" Type="String" />
<asp:Parameter Name="fldEnamn" Type="String" />
</InsertParameters>
<DeleteParameters>
<asp:Parameter Name="fldIdNr" Type="Int32" />
</DeleteParameters>
</asp:SqlDataSource>
Data source for the dropdowncolumn:
<asp:SqlDataSource ID="ds_arbetsplats" runat="server"
ConnectionString="<%$ ConnectionStrings:conn_clients %>"
ProviderName="<%$ ConnectionStrings:conn_clients.ProviderName %>" SelectCommand="SELECT [fldIdNr], [fldNamn] FROM [tblInstitutioner]">
</asp:SqlDataSource>