PC Review


Reply
Thread Tools Rate Thread

DataGrid and SqlCeResultset in CF v2

 
 
2139933@gmail.com
Guest
Posts: n/a
 
      7th Dec 2007
Hi,

Help please to troubleshoot with SqlCeResultset and DataGrid in CF
v2.


I do so:


public System.Data.SqlServerCe.SqlCeResultSet CustsResulSet = null;


public SqlCeResultSet GetExecuteResultSet(string _comText, bool
_updatable)
{
SqlCeCommand cmd = new SqlCeCommand(_comText,
sqlCeConnection);
resultSetOptions = ResultSetOptions.Scrollable;
if (_updatable) resultSetOptions = (resultSetOptions |
ResultSetOptions.Updatable);
return cmd.ExecuteResultSet(this.resultSetOptions);



}


public void GetData()
{
CustsResulSe = GetExecuteResultSet("SELECT [Name] FROM
[Customs]",
false);
DataGrid.DataSource = CustsResulSet;
label1.Text = CustsResulSet.GetString(0);
label2.Text =
CustsResulSet.GetString(DataGrid.CurrentRowIndex);


}


After performance GetData I see that in DataGrid cursor stands on
first row,
but label1 and label2 show data from last seen row, why this can
occur?
How me correctly synchronize positions of cursor in DataGrid and
SqlCeResultset?

Many thanked,


Alexander
 
Reply With Quote
 
 
 
 
Ginny Caughey [MVP]
Guest
Posts: n/a
 
      3rd Jan 2008
Alexander,

It looks like you want to databind the labels to something in the current
row of the SqlCeResultset. I don't think I've ever tried this with a label,
but for a TextBox you can use TextBox.DataBindings.Add("text",
theResultSetOrResultSetView, theColumnNameAsAString) instead of setting the
Text property directly. This may work for labels too - I just never tried
it.

--
Ginny Caughey
Device Application Development MVP


<(E-Mail Removed)> wrote in message
news:d562f1e4-ff86-4ebc-813e-(E-Mail Removed)...
> Hi,
>
> Help please to troubleshoot with SqlCeResultset and DataGrid in CF
> v2.
>
>
> I do so:
>
>
> public System.Data.SqlServerCe.SqlCeResultSet CustsResulSet = null;
>
>
> public SqlCeResultSet GetExecuteResultSet(string _comText, bool
> _updatable)
> {
> SqlCeCommand cmd = new SqlCeCommand(_comText,
> sqlCeConnection);
> resultSetOptions = ResultSetOptions.Scrollable;
> if (_updatable) resultSetOptions = (resultSetOptions |
> ResultSetOptions.Updatable);
> return cmd.ExecuteResultSet(this.resultSetOptions);
>
>
>
> }
>
>
> public void GetData()
> {
> CustsResulSe = GetExecuteResultSet("SELECT [Name] FROM
> [Customs]",
> false);
> DataGrid.DataSource = CustsResulSet;
> label1.Text = CustsResulSet.GetString(0);
> label2.Text =
> CustsResulSet.GetString(DataGrid.CurrentRowIndex);
>
>
> }
>
>
> After performance GetData I see that in DataGrid cursor stands on
> first row,
> but label1 and label2 show data from last seen row, why this can
> occur?
> How me correctly synchronize positions of cursor in DataGrid and
> SqlCeResultset?
>
> Many thanked,
>
>
> Alexander


 
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
Datagrid binded to sqlceresultset (how to) Destiny.. Microsoft Dot NET Compact Framework 4 18th Dec 2008 08:42 AM
SqlCeResultSet and DataGrid and TableStyles Adam Microsoft Dot NET Compact Framework 2 24th Nov 2007 12:48 AM
DataGrid with SqlCeResultSet vijay Microsoft Dot NET Compact Framework 0 8th Aug 2007 02:27 AM
SqlCeResultSet and datagrid Ben Schwehn Microsoft Dot NET Compact Framework 5 25th Mar 2006 01:05 PM
SqlCeResultSet with DataGrid =?Utf-8?B?R28gTW9iaWxl?= Microsoft Dot NET Compact Framework 1 22nd Jun 2005 09:44 PM


Features
 

Advertising
 

Newsgroups
 


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