We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

grid error

I''m using this code to fill databoundgrid SqlConnection conn = null; string imeTablice=""; conn = new SqlConnection(sConn); conn.Open(); SqlCommand cmd = new SqlCommand(); cmd.CommandText = "dbo.[ReceptiSearch]"; cmd.CommandType = CommandType.StoredProcedure; cmd.Connection = conn; cmd.Parameters.Add (new SqlParameter ("@Naziv", tbNaziv.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.Grid.DataMember = ""; SqlDataAdapter adap = new SqlDataAdapter(); adap.SelectCommand = cmd; DataSet ds = new DataSet (); adap.Fill (ds, TableName); gridSearch.Grid.DataSource = ds; gridSearch.Grid.DataMember = TableName; I get an error : Cannot create a child list for field Cakes.

2 Replies

AD Administrator Syncfusion Team December 9, 2005 03:40 PM UTC

Something to try. Instead of setting both grid.DataSource and grid.DataMember, just set grid.DataSource = dataSet.Tables[TableName]; to see if that avoids this problem. Is that the exact message you get? If so, the message is not coming from the grid library as that string is not present in the library. If you replace the GridDataBoundGrid with a Windows Forms DataGrid, do you get the same message? If you step through the code, exactly what line are you seeing the error on?


HV Hrvoje Voda December 12, 2005 10:17 AM UTC

I tried withoud DataMember, but I get the same error message. It stops at gridSearch.DataSource = ds.Table [tableName];

Loader.
Live Chat Icon For mobile
Up arrow icon