G
Guest
Environment C# 2003
I have a stored procedure consisting of two select statements. I succesfully dragged this onto a new dataset creating a 2 table dataset. I also verified that the relation between the tables is correct.
I use this code in an attempt to fill the tables:
DataSets.CompContRelate ds = new Contacts.DataSets.CompContRelate();
string str = ConfigurationSettings.AppSettings["SqlConnection"];
SqlConnection con = new SqlConnection(ConfigurationSettings.AppSettings["SqlConnection"]);
SqlDataAdapter da = new SqlDataAdapter ("sp_GetCompanyContact", con);
da.SelectCommand.CommandType = CommandType.StoredProcedure;
da.Fill(ds.CompanyTbl);
da.Fill(ds.ContactTbl);
return ds;
However, I'm getting a contraint exception on the second fill. I've verified that all the correct required fields are in fact non-null. I've verified that each record in the contact table correctly relates to an existing record in the company table.
Any ideas or suggestions?
Thanks,
Dave
I have a stored procedure consisting of two select statements. I succesfully dragged this onto a new dataset creating a 2 table dataset. I also verified that the relation between the tables is correct.
I use this code in an attempt to fill the tables:
DataSets.CompContRelate ds = new Contacts.DataSets.CompContRelate();
string str = ConfigurationSettings.AppSettings["SqlConnection"];
SqlConnection con = new SqlConnection(ConfigurationSettings.AppSettings["SqlConnection"]);
SqlDataAdapter da = new SqlDataAdapter ("sp_GetCompanyContact", con);
da.SelectCommand.CommandType = CommandType.StoredProcedure;
da.Fill(ds.CompanyTbl);
da.Fill(ds.ContactTbl);
return ds;
However, I'm getting a contraint exception on the second fill. I've verified that all the correct required fields are in fact non-null. I've verified that each record in the contact table correctly relates to an existing record in the company table.
Any ideas or suggestions?
Thanks,
Dave