How can i bind dataset to an datagrid?

R

Ralf Christoff

Hi,
this Code works fine under Windows:

SqlConnection conn = new SqlConnection(.SQLCon);
SqlCommand cmd = new SqlCommand(SQL, conn);
SqlDataAdapter adapter = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
adapter.Fill(ds);

if(ds.Tables.Count>0)
{
dg_Query.SetDataBinding(ds,"Table");
tabControl1.TabPages[0].Controls.Add(dg_Query);
}
if(ds.Tables.Count>1)
{
dg_Query1.SetDataBinding(ds,"Table1");
tabControl1.TabPages[1].Controls.Add(dg_Query1);
}

but with .net Compact Framework
dg_Query.SetDataBinding(ds,"Table"); not work because
datagrid dg_Query has no "SetDataBindings" has no definition.

How can i bind in this example my dataset to the datagrid?

sorry for my bad english,
thanx,
Ralf
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top