PC Review


Reply
Thread Tools Rate Thread

Binding SqlCE to Datagrid

 
 
Nathan Zumwalt
Guest
Posts: n/a
 
      16th Feb 2004
I've created an SqlCE database and I'm trying to bind it to a DataGrid
using C#.

I tried to use this code:
http://samples.gotdotnet.com/quickst.../datagrid.aspx

After converting it to C#, I get the following error:
'System.Data.SqlServerCe.SqlCeDataAdapter' does not contain a
definition for 'Fill'.

Am I making some newbie mistake? If this isn't the way to do it, how
do I bind my SqlCE connection to a Datagrid?

-Nathan
 
Reply With Quote
 
 
 
 
Paul G. Tobey [eMVP]
Guest
Posts: n/a
 
      16th Feb 2004
You don't really bind a connection to a grid. You bind a table to a grid.
Something like:

String query = String.Format( "SELECT * FROM {0};", UpdateSelectEdit.Text );

SqlCommand cmd = new SqlCommand( query,

sqlconnect );

dataset = new DataSet();

dataadapter = new SqlDataAdapter();

dataadapter.SelectCommand = cmd;

dataadapter.Fill(dataset);

ResultGrid.DataSource = dataset.Tables[ 0 ];

In this case, UpdateSelectEdit is a TextEdit where the table name is entered
by the user. Sqlconnect is the SQL connection object.



Paul T.



"Nathan Zumwalt" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I've created an SqlCE database and I'm trying to bind it to a DataGrid
> using C#.
>
> I tried to use this code:
> http://samples.gotdotnet.com/quickst.../datagrid.aspx
>
> After converting it to C#, I get the following error:
> 'System.Data.SqlServerCe.SqlCeDataAdapter' does not contain a
> definition for 'Fill'.
>
> Am I making some newbie mistake? If this isn't the way to do it, how
> do I bind my SqlCE connection to a Datagrid?
>
> -Nathan



 
Reply With Quote
 
Y. Sivaram
Guest
Posts: n/a
 
      16th Feb 2004
Also ensure that you have set Reference to System.Data.Common under project
references.

Best Regards,
Y. Sivaram

"Nathan Zumwalt" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I've created an SqlCE database and I'm trying to bind it to a DataGrid
> using C#.
>
> I tried to use this code:
> http://samples.gotdotnet.com/quickst.../datagrid.aspx
>
> After converting it to C#, I get the following error:
> 'System.Data.SqlServerCe.SqlCeDataAdapter' does not contain a
> definition for 'Fill'.
>
> Am I making some newbie mistake? If this isn't the way to do it, how
> do I bind my SqlCE connection to a Datagrid?
>
> -Nathan



 
Reply With Quote
 
Nathan Zumwalt
Guest
Posts: n/a
 
      17th Feb 2004
This was my problem.... I didn't have a reference to the
System.Data.Common namespace.

Thanks!

-Nathan

"Y. Sivaram" <(E-Mail Removed)> wrote in message news:<(E-Mail Removed)>...
> Also ensure that you have set Reference to System.Data.Common under project
> references.
>
> Best Regards,
> Y. Sivaram
>
> "Nathan Zumwalt" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > I've created an SqlCE database and I'm trying to bind it to a DataGrid
> > using C#.
> >
> > I tried to use this code:
> > http://samples.gotdotnet.com/quickst.../datagrid.aspx
> >
> > After converting it to C#, I get the following error:
> > 'System.Data.SqlServerCe.SqlCeDataAdapter' does not contain a
> > definition for 'Fill'.
> >
> > Am I making some newbie mistake? If this isn't the way to do it, how
> > do I bind my SqlCE connection to a Datagrid?
> >
> > -Nathan

 
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
Binding to a datagrid Khan Microsoft Dot NET Framework 1 21st Apr 2008 06:06 PM
Binding Datagrid to SQLCE DB Scott Toney Microsoft VB .NET 1 28th Apr 2005 05:27 PM
DataGrid without binding CD Microsoft C# .NET 3 16th Jan 2005 02:21 AM
DataGrid + SqlCE + 15k rows Sztahoo Microsoft Dot NET Compact Framework 3 16th Dec 2004 02:20 AM
threading, what different between DataGrid Binding to Binding TextBox mttc Microsoft Dot NET Framework Forms 3 19th Nov 2004 08:33 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:55 AM.