PC Review


Reply
 
 
Rafael Metring
Guest
Posts: n/a
 
      27th Feb 2004
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


 
Reply With Quote
 
 
 
 
Paul G. Tobey [eMVP]
Guest
Posts: n/a
 
      27th Feb 2004
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=e...mpactframework

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

-----

Paul T.

"Rafael Metring" <(E-Mail Removed)> wrote in message
news:%23mJI1TW$(E-Mail Removed)...
> 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
>
>



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Databind ?? Adam J Knight Microsoft ASP .NET 2 1st Feb 2006 11:10 PM
Databind # ? ad Microsoft ASP .NET 2 22nd Jul 2005 11:18 PM
Do I need to DataBind twice? Andy Fish Microsoft ASP .NET 2 4th Nov 2004 01:30 PM
Databind Steven Licciardi Microsoft Dot NET Compact Framework 2 24th Feb 2004 07:43 PM
DataBind Calvin Lai Microsoft ASP .NET 1 24th Jan 2004 10:44 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:05 PM.