hey,,

i created one application in asp.net in vc# wich required the results of a stored procedure to be displayed into a datagridview.heres d code..,,

SqlConnection mysql = new SqlConnection(@"Integrated Security=SSPI;Data Source=MANU\SQLEXPRESS;Initial Catalog=info;");
mysql.Open();

SqlCommand searchcmd = new SqlCommand("search", mysql);
searchcmd.CommandType = CommandType.StoredProcedure;
searchcmd.Parameters.Add(new SqlParameter("@sname", SqlDbType.VarChar, 20));
searchcmd.Parameters["@sname"].Value = textBox1.Text.ToString();

SqlDataAdapter da = new SqlDataAdapter(searchcmd);
DataSet ds = new DataSet();
da.Fill(ds);
searchcmd.ExecuteNonQuery();

dataGridView1.DataSource = ds;
dataGridView1.DataMember = "addressbook"

mysql.Close();

and when i run thiss..i get the followin error..

"Child list for field addressbook cannot be created"

can ne1 help me with this...!!!!!

okay..,, i figured out the solution..!!!

well...the problem was that the table doesnt retain its original name once it is in dataset..!! this is the solution..

dataGridView1.DataMember = ds.Tables[0].TableName;

cheers ~

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.