I created an vb.net aspx page with three dropdown menus. All three dropdown menus are connected to a table in SQL. When the page is load dropdown #1 is populated with two database selections to choose from. Depending on what database you select dropdown #2 and #3 will be populated with different data. The problem, I'm having is when the page is loaded and select an item in dropdown menu #2 or/and #3 and select the submit button, I get an error message like so:
Exception Details: System.Data.SqlClient.SqlException: INSERT statement conflicted with COLUMN FOREIGN KEY constraint 'User_FK00'. The conflict occurred in database 'OMNIVISOR_PLUS_HCMB', table 'PatientGroup', column 'PatientGroupID'. Cannot insert the value NULL into column 'UserID', table 'OMNIVISOR_PLUS_HCMB.dbo.Professional'; column does not allow nulls. INSERT fails. The statement has been terminated. The statement has been terminated.
After doing it serveral time, I figured out that when the page is loaded , the items in the dropdowns are connected to the SQL database. But once I select another items from the dropdowns, I lose connections to the SQL database. How can I prevent this from happening. I attempted to use Page.IsPostBack but it doesn't seem the fix the problem.
Any ideas? Help!