DataSet

  • Thread starter Thread starter Lou
  • Start date Start date
L

Lou

I need to convert a VB6 Disconnected Recordset project to C#.

The VB6 app uses ADO to create a recordset, add fields, add data.
It then Binds to a grid.

The VB6 App uses the client side cursor. When ever I move through the
Recordset
using (MoveNext,MovePrevious,Find) th Grids cursor position mirrors the
recordset
row. I can't seem to duplicate this in C#. I can create a Dataset, add
fields, add data
and use the "Find" method and bind the datagrid BUT the grids cursor doesn't
track.
Also I can't find the Navigate functions in the
Dataset(MoveNext,MovePrevious,EOF,BOF)
I really need those.
is there a "Cursor" in the Dataset?
I am somewhat confused, I'm still thinking in the older ADO world...

Can someone point me in the right direction?
Thanks...

-Lou
 
You can curse through a DataSet, but it is a matter of moving through the
rows. You can also opt to move through using XML. It is different than ADO,
of course.

What exactly are you trying to do. Figure out which row you are on in a
disconnected architecture? Be specific to the business problem rather than
the technology problem, as it is likely you will use a different method to
solve the problem.


---

Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************
 
Hi Lou,

The closest equivalent atleast as far as similar to programming technique
goes is DataReader.

DataSet introduces a different method of accessing data, in which you get
this sort of like a mini rdbms in memory with a collection of tables and
relations - tables can have constraints on them even. Then you can access
data inside the dataset by using something like

DataSet.Tables[0].Rows[0][0] <--- Gives you the value of the first table,
first row, first column .. so on so forth.

The biggest plus to the dataset is it is COMPLETELY disconnected from the
d/b, so it lends itself very well to distributed programming. Also it is
extremely good at maintaining state changes (delete/add/modify etc.) .. for
more on this you can read DataViewRowState Constants in MSDN.

ADO.NET is fantastic compared to ADO, but true it takes some getting used
to. I recommend buying a book :-)

- Sahil Malik
http://dotnetjunkies.com/weblog/sahilmalik
http://blogs.apress.com/authors.php?author=Sahil Malik
 
There is no business problem, just trying to re-write a current Broadcast
Playback Engine using C#.
I need to do a one-for one in going from a disconnected ADO recordset in VB6
to C#.
There is no Database, I simply use ADO Recordsets to manage a view.
I'm not finding the same methods in the C# Dataset that were in the
ADO.Recordset collection.
 
My current app uses a disconnecte recordset, there is no DB, i just like
using the ADODB.Recordset
object's methods tied to a grid where the grids cursor follows the Recordset
cursor.

Dim PL As ADODB.Recordset
PL.Fields.Add("Etc")
'Add some data

'Set the grids DataSource
Set Grid.Datasource=PL

Now the grid mirrors the Recordset, including the cursor position
I then use Recordset clones and all the good stuf with ADO.


Sahil Malik said:
Hi Lou,

The closest equivalent atleast as far as similar to programming technique
goes is DataReader.

DataSet introduces a different method of accessing data, in which you get
this sort of like a mini rdbms in memory with a collection of tables and
relations - tables can have constraints on them even. Then you can access
data inside the dataset by using something like

DataSet.Tables[0].Rows[0][0] <--- Gives you the value of the first table,
first row, first column .. so on so forth.

The biggest plus to the dataset is it is COMPLETELY disconnected from the
d/b, so it lends itself very well to distributed programming. Also it is
extremely good at maintaining state changes (delete/add/modify etc.) .. for
more on this you can read DataViewRowState Constants in MSDN.

ADO.NET is fantastic compared to ADO, but true it takes some getting used
to. I recommend buying a book :-)

- Sahil Malik
http://dotnetjunkies.com/weblog/sahilmalik
http://blogs.apress.com/authors.php?author=Sahil Malik




Lou said:
I need to convert a VB6 Disconnected Recordset project to C#.

The VB6 app uses ADO to create a recordset, add fields, add data.
It then Binds to a grid.

The VB6 App uses the client side cursor. When ever I move through the
Recordset
using (MoveNext,MovePrevious,Find) th Grids cursor position mirrors the
recordset
row. I can't seem to duplicate this in C#. I can create a Dataset, add
fields, add data
and use the "Find" method and bind the datagrid BUT the grids cursor doesn't
track.
Also I can't find the Navigate functions in the
Dataset(MoveNext,MovePrevious,EOF,BOF)
I really need those.
is there a "Cursor" in the Dataset?
I am somewhat confused, I'm still thinking in the older ADO world...

Can someone point me in the right direction?
Thanks...

-Lou
 
Hi Lou,

I think the solution is the CurrencyManager.

Inside the form that contains the DataGrid control you can access the
CurrencyManager by the following:

private void btnNext_Click(object sender, System.EventArgs e)
{
if (BindingContext[myGrid.DataSource].Position != 0) {
BindingContext[myGrid.DataSource].Position -= 1;
}
}


Sincerely,
Stefan Lieser
 
Back
Top