I want to store the following code into the database:
fun(...);
int main()
{
fun(3, 7, -11.2, 0.66);
return 0;
}
fun(...)
{
va_list ptr;
int num;
va_start(ptr, n);
num = va_arg(ptr, int);
printf("%d", num);
}
and then get it back in the dataset and display on a page.
As of now I have successfully stored the questions with varchar(MAX) datatype but when I try to get it in the dataset i get the following error:
Failed To Enable Constraints. One Or More Rows Contain Values Violating Non-null, Unique, Or Foreign-key Constraints.
I am doing this in a ASP.NET web application.
EDIT: Here is the Table definition of the table I am inserting the data into

The query I am using to insert the data into the table:
con.ConnectionString = constr;
cmd.Connection = con;
cmd.CommandText = "insert into QuesTable values(@D1,@D2,@D3,@D4,@D5,@D6,@D7, NULL)";
cmd.Parameters.Add("@D1", SqlDbType.Int).Value = txtQID.Text;
cmd.Parameters.Add("@D2", SqlDbType.VarChar).Value = txtques.Text;
cmd.Parameters.Add("@D3", SqlDbType.VarChar).Value = txtansa.Text;
cmd.Parameters.Add("@D4", SqlDbType.VarChar).Value = txtansb.Text;
cmd.Parameters.Add("@D5", SqlDbType.VarChar).Value = txtansc.Text;
cmd.Parameters.Add("@D6", SqlDbType.VarChar).Value = txtansd.Text;
cmd.Parameters.Add("@D7", SqlDbType.VarChar).Value = txtcorr.Text;
con.Open();
int i = cmd.ExecuteNonQuery();
con.Close();
And finally the code by which I am extracting the data from the dataset
DataSet1.QuesTableDataTable dt = new DataSet1.QuesTableDataTable();
DataSet1TableAdapters.QuesTableTableAdapter adp = new DataSet1TableAdapters.QuesTableTableAdapter();
dt = adp.GetData();
DataTable dtUser = dt.Clone();
Hope the information is helpful.
AnsaAnsbandansc? Why not have an answers table so you don't need to split this stuff out?AnsaisOption A,Option B, and so on ...e?ein the initial release.. will scale up in the future