How to use ADO recordset format in ADO.NET?

S

Sylvain COADOU

Hello
I'm working on an ASP.NET webapp and I must fill a datagrid with some old
ADO recordset format XML files (made with Save command in vb6) which is not
(fully) compatible with ADO.NET.
Do you a trick to allow this?

Sylvain
 
C

Cowboy \(Gregory A. Beamer\)

You will either have to:

1. Use interop, with ADO
2. Consume as XML
3. Transform the XML into the ADO.NET format

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

***********************************************
Think Outside the Box!
***********************************************
 
G

Guest

Sylvain,

From Help:

"To provide access from ADO.NET to ADO Recordset and Record objects, the
..NET Framework Data Provider for OLE DB overloads the Fill method of the
OleDbDataAdapter to accept an ADO Recordset or Record object."

There is more detailed info in Help, under DataTable class, accessing ADO
Recordset or Record.

Kerry Moorman
 
S

S.M. Altaf [MVP]

I'm not totally familiar with ADO in ASP.NET pages, but you mentioned that
you have XML files. What about using Dataset.ReadXML()?
-Altaf
 
C

Cor Ligthert [MVP]

Sylvian,

I assume that your XML file is a self build XML file.

That means that you can read that file using the XMLTextreader.

See this sample (The XML is in the sample)

http://www.vb-tips.com/default.aspx?ID=e788c048-e547-4de3-9c6a-22589f018cd4

Than you can set that item by item in a datatable, which you can use as a
datasource for your datagrid.

To create an empty datatable it is

dim dt as new datatable
dt.columns.add(mycolumn1,gettype(system.String))'or other types in VB helps
intelligence for that.
etc. for all columns

Filling a datatable while you are reading is probably nothing more than
creating the fields and than

dt.loaddatarow(new object() {field1,field2,field3},true)

and than setting this to your datagrid

datagrid1.datasource = dt
datagrid1.databind

I hope this helps,

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top