HighTechTalks DotNet Forums  

DataGrid and SqlCeResultset in CF v2

Dotnet Framework (Compact Framework) microsoft.public.dotnet.framework.compactframework


Discuss DataGrid and SqlCeResultset in CF v2 in the Dotnet Framework (Compact Framework) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
2139933@gmail.com
 
Posts: n/a

Default DataGrid and SqlCeResultset in CF v2 - 12-07-2007 , 04:20 AM






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
  #2  
Old   
Ginny Caughey [MVP]
 
Posts: n/a

Default Re: DataGrid and SqlCeResultset in CF v2 - 01-03-2008 , 10:49 AM






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


<2139933 (AT) gmail (DOT) com> wrote

Quote:
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 Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.