DataBoundList Pass null Value

elfredasvilcas

New Member
I have a databoundlist that is bound to SQLDataSource. My SQL Table has a field that is a foreign key and is allowed to accept null values. The primary table is empty (No Record).
When i open up the web page and fill all the fields except this one, SQL throws an error \[code\]Error converting varchar to numeric\[/code\]I have done this: \[code\]protected void ddlAuthPersonName_DataBound(object sender, EventArgs e){ ddlAuthPersonName.Items.Insert(0, new ListItem("- Select -","0" ));} \[/code\]Still no luck. I want the user to select a value if it is available, otherwise pass a null value to the Insert Query. Any way how to do it would be appreciated. EDIT \[code\] <asp:SqlDataSource ID="sqlDsAuthPersonName" runat="server" ConnectionString="<%$ Connecrings:asContionString %>" SelectCommand="SELECT [Person_Name], [authorized_PersonID] FROM [AuthorizedPersons] ORDER BY [Person_Name]"> </asp:SqlDataSource>\[/code\]
 
Back
Top