471,348 Members | 1,378 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,348 software developers and data experts.

grid error

I use this code to fill a grid.
SqlConnection conn = null;

string TableName="";
conn = new

SqlConnection(sConn);

conn.Open();

SqlCommand cmd = new SqlCommand("RecepiesSearch", conn);

cmd.CommandType = CommandType.StoredProcedure;

cmd.Connection = conn;

cmd.Parameters.Add (new SqlParameter ("@Name", tbName.Text ));

cmd.Parameters.Add( new System.Data.SqlClient.SqlParameter( "@tbl",
System.Data.SqlDbType.NVarChar, 50, System.Data.ParameterDirection.Output,
true, ((System.Byte)(0)), ((System.Byte)(0)), "tbl",
System.Data.DataRowVersion.Current, null));

cmd.ExecuteNonQuery();

TableName = cmd.Parameters["@tbl"].Value.ToString();
gridSearch.DataMember = "";
SqlDataAdapter adap = new SqlDataAdapter();

adap.SelectCommand = cmd;

DataSet ds = new DataSet ();

adap.Fill (ds, TableName);

gridSearch.DataSource = ds;

gridSearch.DataMember = TableName;

But, I get an error after gridSearch.DataMember = TableName : " Cannot
create a child list for field Cakes".

Hrcko
Dec 13 '05 #1
0 802

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

12 posts views Thread by pmud | last post: by
4 posts views Thread by Filippo Pandiani | last post: by
1 post views Thread by Nikhil Patel | last post: by
1 post views Thread by inr | last post: by
1 post views Thread by Ronak mishra | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.