Hi
I keep getting the following error:
Error: You tried to assign the Null value to a variable that is not a Variant data type
When trying to insert a new record into an Access 2003 Database using the Details View tool. I have tried using a seperate entry page as well as adding the insert option in Details View but each time I still get the above error.
Any help will be gratefully recieved.
Here is the code I'm using:
<body>
<form id="form1" runat="server">
<div>
<br />
<br />
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:Button ID="Button1" runat="server" Text="Button" /><br />
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:EMCServerlistLatest %>"
DeleteCommand="DELETE FROM [SIRIUS_Contacts] WHERE [ID] = ?" InsertCommand="INSERT INTO [SIRIUS_Contacts] ([SiteName], [Trinome], [Address], [floor], [PostCode], [Primary_Onsite_Contact], [Primary_Onsite_Contact_Number], [Secondary_Onsite_Contact], [ID], [Secondary_Onsite_Contact_Number]) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"
ProviderName="<%$ ConnectionStrings:EMCServerlistLatest.ProviderName %>" SelectCommand="SELECT * FROM [SIRIUS_Contacts] WHERE ([Trinome] LIKE '%' + ? + '%')"
UpdateCommand="UPDATE [SIRIUS_Contacts] SET [SiteName] = ?, [Trinome] = ?, [Address] = ?, [floor] = ?, [PostCode] = ?, [Primary_Onsite_Contact] = ?, [Primary_Onsite_Contact_Number] = ?, [Secondary_Onsite_Contact] = ?, [Secondary_Onsite_Contact_Number] = ? WHERE [ID] = ?">
<DeleteParameters>
<asparameter Name="ID" Type="Int32" />
</DeleteParameters>
<UpdateParameters>
<asparameter Name="SiteName" Type="String" />
<asparameter Name="Trinome" Type="String" />
<asparameter Name="Address" Type="String" />
<asparameter Name="floor" Type="String" />
<asparameter Name="PostCode" Type="String" />
<asparameter Name="Primary_Onsite_Contact" Type="String" />
<asparameter Name="Primary_Onsite_Contact_Number" Type="String" />
<asparameter Name="Secondary_Onsite_Contact" Type="String" />
<asparameter Name="Secondary_Onsite_Contact_Number" Type="String" />
<asparameter Name="ID" Type="Int32" />
</UpdateParameters>
<SelectParameters>
<asp:ControlParameter ControlID="TextBox1" Name="Trinome" PropertyName="Text" Type="String" />
</SelectParameters>
<InsertParameters>
<asparameter Name="SiteName" Type="String" />
<asparameter Name="Trinome" Type="String" />
<asparameter Name="Address" Type="String" />
<asparameter Name="floor" Type="String" />
<asparameter Name="PostCode" Type="String" />
<asparameter Name="Primary_Onsite_Contact" Type="String" />
<asparameter Name="Primary_Onsite_Contact_Number" Type="String" />
<asparameter Name="Secondary_Onsite_Contact" Type="String" />
<asparameter Name="ID" Type="Int32" />
<asparameter Name="Secondary_Onsite_Contact_Number" Type="String" />
</InsertParameters>
</asp:SqlDataSource>
</div>
<aspetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" DataKeyNames="ID"
DataSourceID="SqlDataSource2" Height="50px" Width="125px" DefaultMode="Insert">
<Fields>
<asp:BoundField DataField="SiteName" HeaderText="SiteName" SortExpression="SiteName" />
<asp:BoundField DataField="Trinome" HeaderText="Trinome" SortExpression="Trinome" />
<asp:BoundField DataField="Address" HeaderText="Address" SortExpression="Address" />
<asp:BoundField DataField="floor" HeaderText="floor" SortExpression="floor" />
<asp:BoundField DataField="PostCode" HeaderText="PostCode" SortExpression="PostCode" />
<asp:BoundField DataField="Primary_Onsite_Contact" HeaderText="Primary_Onsite_Contact"
SortExpression="Primary_Onsite_Contact" />
<asp:BoundField DataField="Primary_Onsite_Contact_Number" HeaderText="Primary_Onsite_Contact_Number"
SortExpression="Primary_Onsite_Contact_Number" />
<asp:BoundField DataField="Secondary_Onsite_Contact" HeaderText="Secondary_Onsite_Contact"
SortExpression="Secondary_Onsite_Contact" />
<asp:BoundField DataField="ID" HeaderText="ID" InsertVisible="False" ReadOnly="True"
SortExpression="ID" />
<asp:BoundField DataField="Secondary_Onsite_Contact_Number" HeaderText="Secondary_Onsite_Contact_Number"
SortExpression="Secondary_Onsite_Contact_Number" />
<asp:CommandField ShowInsertButton="True" />
</Fields>
</aspetailsView>
<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:EMCServerlistLatest %>"
DeleteCommand="DELETE FROM [SIRIUS_Contacts] WHERE [ID] = ?" InsertCommand="INSERT INTO [SIRIUS_Contacts] ([SiteName], [Trinome], [Address], [floor], [PostCode], [Primary_Onsite_Contact], [Primary_Onsite_Contact_Number], [Secondary_Onsite_Contact], [ID], [Secondary_Onsite_Contact_Number]) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"
ProviderName="<%$ ConnectionStrings:EMCServerlistLatest.ProviderName %>" SelectCommand="SELECT * FROM [SIRIUS_Contacts] WHERE ([Trinome] LIKE '%' + ? + '%')"
UpdateCommand="UPDATE [SIRIUS_Contacts] SET [SiteName] = ?, [Trinome] = ?, [Address] = ?, [floor] = ?, [PostCode] = ?, [Primary_Onsite_Contact] = ?, [Primary_Onsite_Contact_Number] = ?, [Secondary_Onsite_Contact] = ?, [Secondary_Onsite_Contact_Number] = ? WHERE [ID] = ?">
<DeleteParameters>
<asparameter Name="ID" Type="Int32" />
</DeleteParameters>
<UpdateParameters>
<asparameter Name="SiteName" Type="String" />
<asparameter Name="Trinome" Type="String" />
<asparameter Name="Address" Type="String" />
<asparameter Name="floor" Type="String" />
<asparameter Name="PostCode" Type="String" />
<asparameter Name="Primary_Onsite_Contact" Type="String" />
<asparameter Name="Primary_Onsite_Contact_Number" Type="String" />
<asparameter Name="Secondary_Onsite_Contact" Type="String" />
<asparameter Name="Secondary_Onsite_Contact_Number" Type="String" />
<asparameter Name="ID" Type="Int32" />
</UpdateParameters>
<SelectParameters>
<asp:ControlParameter ControlID="TextBox1" Name="Trinome" PropertyName="Text" Type="String" />
</SelectParameters>
<InsertParameters>
<asparameter Name="SiteName" Type="String" />
<asparameter Name="Trinome" Type="String" />
<asparameter Name="Address" Type="String" />
<asparameter Name="floor" Type="String" />
<asparameter Name="PostCode" Type="String" />
<asparameter Name="Primary_Onsite_Contact" Type="String" />
<asparameter Name="Primary_Onsite_Contact_Number" Type="String" />
<asparameter Name="Secondary_Onsite_Contact" Type="String" />
<asparameter Name="ID" Type="Int32" />
<asparameter Name="Secondary_Onsite_Contact_Number" Type="String" />
</InsertParameters>
</asp:SqlDataSource>
</form>
I keep getting the following error:
Error: You tried to assign the Null value to a variable that is not a Variant data type
When trying to insert a new record into an Access 2003 Database using the Details View tool. I have tried using a seperate entry page as well as adding the insert option in Details View but each time I still get the above error.
Any help will be gratefully recieved.
Here is the code I'm using:
<body>
<form id="form1" runat="server">
<div>
<br />
<br />
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:Button ID="Button1" runat="server" Text="Button" /><br />
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:EMCServerlistLatest %>"
DeleteCommand="DELETE FROM [SIRIUS_Contacts] WHERE [ID] = ?" InsertCommand="INSERT INTO [SIRIUS_Contacts] ([SiteName], [Trinome], [Address], [floor], [PostCode], [Primary_Onsite_Contact], [Primary_Onsite_Contact_Number], [Secondary_Onsite_Contact], [ID], [Secondary_Onsite_Contact_Number]) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"
ProviderName="<%$ ConnectionStrings:EMCServerlistLatest.ProviderName %>" SelectCommand="SELECT * FROM [SIRIUS_Contacts] WHERE ([Trinome] LIKE '%' + ? + '%')"
UpdateCommand="UPDATE [SIRIUS_Contacts] SET [SiteName] = ?, [Trinome] = ?, [Address] = ?, [floor] = ?, [PostCode] = ?, [Primary_Onsite_Contact] = ?, [Primary_Onsite_Contact_Number] = ?, [Secondary_Onsite_Contact] = ?, [Secondary_Onsite_Contact_Number] = ? WHERE [ID] = ?">
<DeleteParameters>
<asparameter Name="ID" Type="Int32" />
</DeleteParameters>
<UpdateParameters>
<asparameter Name="SiteName" Type="String" />
<asparameter Name="Trinome" Type="String" />
<asparameter Name="Address" Type="String" />
<asparameter Name="floor" Type="String" />
<asparameter Name="PostCode" Type="String" />
<asparameter Name="Primary_Onsite_Contact" Type="String" />
<asparameter Name="Primary_Onsite_Contact_Number" Type="String" />
<asparameter Name="Secondary_Onsite_Contact" Type="String" />
<asparameter Name="Secondary_Onsite_Contact_Number" Type="String" />
<asparameter Name="ID" Type="Int32" />
</UpdateParameters>
<SelectParameters>
<asp:ControlParameter ControlID="TextBox1" Name="Trinome" PropertyName="Text" Type="String" />
</SelectParameters>
<InsertParameters>
<asparameter Name="SiteName" Type="String" />
<asparameter Name="Trinome" Type="String" />
<asparameter Name="Address" Type="String" />
<asparameter Name="floor" Type="String" />
<asparameter Name="PostCode" Type="String" />
<asparameter Name="Primary_Onsite_Contact" Type="String" />
<asparameter Name="Primary_Onsite_Contact_Number" Type="String" />
<asparameter Name="Secondary_Onsite_Contact" Type="String" />
<asparameter Name="ID" Type="Int32" />
<asparameter Name="Secondary_Onsite_Contact_Number" Type="String" />
</InsertParameters>
</asp:SqlDataSource>
</div>
<aspetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" DataKeyNames="ID"
DataSourceID="SqlDataSource2" Height="50px" Width="125px" DefaultMode="Insert">
<Fields>
<asp:BoundField DataField="SiteName" HeaderText="SiteName" SortExpression="SiteName" />
<asp:BoundField DataField="Trinome" HeaderText="Trinome" SortExpression="Trinome" />
<asp:BoundField DataField="Address" HeaderText="Address" SortExpression="Address" />
<asp:BoundField DataField="floor" HeaderText="floor" SortExpression="floor" />
<asp:BoundField DataField="PostCode" HeaderText="PostCode" SortExpression="PostCode" />
<asp:BoundField DataField="Primary_Onsite_Contact" HeaderText="Primary_Onsite_Contact"
SortExpression="Primary_Onsite_Contact" />
<asp:BoundField DataField="Primary_Onsite_Contact_Number" HeaderText="Primary_Onsite_Contact_Number"
SortExpression="Primary_Onsite_Contact_Number" />
<asp:BoundField DataField="Secondary_Onsite_Contact" HeaderText="Secondary_Onsite_Contact"
SortExpression="Secondary_Onsite_Contact" />
<asp:BoundField DataField="ID" HeaderText="ID" InsertVisible="False" ReadOnly="True"
SortExpression="ID" />
<asp:BoundField DataField="Secondary_Onsite_Contact_Number" HeaderText="Secondary_Onsite_Contact_Number"
SortExpression="Secondary_Onsite_Contact_Number" />
<asp:CommandField ShowInsertButton="True" />
</Fields>
</aspetailsView>
<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:EMCServerlistLatest %>"
DeleteCommand="DELETE FROM [SIRIUS_Contacts] WHERE [ID] = ?" InsertCommand="INSERT INTO [SIRIUS_Contacts] ([SiteName], [Trinome], [Address], [floor], [PostCode], [Primary_Onsite_Contact], [Primary_Onsite_Contact_Number], [Secondary_Onsite_Contact], [ID], [Secondary_Onsite_Contact_Number]) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"
ProviderName="<%$ ConnectionStrings:EMCServerlistLatest.ProviderName %>" SelectCommand="SELECT * FROM [SIRIUS_Contacts] WHERE ([Trinome] LIKE '%' + ? + '%')"
UpdateCommand="UPDATE [SIRIUS_Contacts] SET [SiteName] = ?, [Trinome] = ?, [Address] = ?, [floor] = ?, [PostCode] = ?, [Primary_Onsite_Contact] = ?, [Primary_Onsite_Contact_Number] = ?, [Secondary_Onsite_Contact] = ?, [Secondary_Onsite_Contact_Number] = ? WHERE [ID] = ?">
<DeleteParameters>
<asparameter Name="ID" Type="Int32" />
</DeleteParameters>
<UpdateParameters>
<asparameter Name="SiteName" Type="String" />
<asparameter Name="Trinome" Type="String" />
<asparameter Name="Address" Type="String" />
<asparameter Name="floor" Type="String" />
<asparameter Name="PostCode" Type="String" />
<asparameter Name="Primary_Onsite_Contact" Type="String" />
<asparameter Name="Primary_Onsite_Contact_Number" Type="String" />
<asparameter Name="Secondary_Onsite_Contact" Type="String" />
<asparameter Name="Secondary_Onsite_Contact_Number" Type="String" />
<asparameter Name="ID" Type="Int32" />
</UpdateParameters>
<SelectParameters>
<asp:ControlParameter ControlID="TextBox1" Name="Trinome" PropertyName="Text" Type="String" />
</SelectParameters>
<InsertParameters>
<asparameter Name="SiteName" Type="String" />
<asparameter Name="Trinome" Type="String" />
<asparameter Name="Address" Type="String" />
<asparameter Name="floor" Type="String" />
<asparameter Name="PostCode" Type="String" />
<asparameter Name="Primary_Onsite_Contact" Type="String" />
<asparameter Name="Primary_Onsite_Contact_Number" Type="String" />
<asparameter Name="Secondary_Onsite_Contact" Type="String" />
<asparameter Name="ID" Type="Int32" />
<asparameter Name="Secondary_Onsite_Contact_Number" Type="String" />
</InsertParameters>
</asp:SqlDataSource>
</form>