DataBind

  • Thread starter Thread starter Rafael Metring
  • Start date Start date
R

Rafael Metring

Hi

How can I vinculate my data to datagrid?

In vb.net + asp.net I use this

......
dim dr as SqlDatareader = myCommand.ExecuteReader()
DatagridModel.Datasource = dr
DatagridModel.DataBind()


I am trying use this in VB.net pocket

....
dim dr as sqlCeDataReader = mycommand.executereader()
datagrid.datasource = dr

but dont have databind in datagrid..

in other form i used ...

dim dr as sqlcedatareader = mycommand.executereader()
if dr.read()
lblstatus.text = dr.item("NAME")
end if

and this run without problem , only in datagrid have problem..

any suggestions?

Rafael
 
I posted some code the other day that shows what I've done for this. Here's
a link that will allow you to search the archived messages from the
newsgroup:

http://groups.google.com/groups?hl=...soft.public.dotnet.framework.compactframework

Here's the code:

-----

SqlCommand cmd = new SqlCommand( query, // the SQL query to select
the data
sqlconnect ); // the SQL connection

dataset = new DataSet();
dataadapter = new SqlDataAdapter();
dataadapter.SelectCommand = cmd;
dataadapter.Fill(dataset);

ResultGrid.DataSource = dataset.Tables[ 0 ]; // set the DataSource
property of

// the DataGrid instance
 
Back
Top