PC Review


Reply
Thread Tools Rate Thread

Convert ADODB recordset into .Net dataset

 
 
Tor Christian
Guest
Posts: n/a
 
      19th Sep 2003
Hi

I am using a VB6 client which connects to a web service using soap3.0
The client is querying a MSDE and filling up a ADODB.recordset. What I
am trying to acomplish is to send this recordset to the web service
where it will be inserted into another MSDE. Much like a batch job.

The client
-------------------------------------------------------------------------
Dim r As ADODB.Recordset
Dim xml as string
Set r = m_us.db.connection1.Execute("Select * from status") 'Get a
recordset from an ado wrapper

r.Save "c:\doit.xml", adPersistXML ' Save the recordset to disk in XML
format
xml=readXmlFromDisk()'Read the xml from disk into a string

m_service.uploadData(xml)'Use soap to send the string to the
webservice

The web service using C#
--------------------------------------------------------------------------
[WebMethod]
public bool uploadData(string data)
{
//How do I grab the xml string and insert the data into a table?
//My best suggestion is to convert the XML string into a dataset(don`t
know how)
//and save this dataset into the MSDE
}


Thanks

Tor Christian
 
Reply With Quote
 
 
 
 
Prabhat
Guest
Posts: n/a
 
      19th Sep 2003
Hi,

I have a ADO Recordset (rsImages) which is having "Select * FROM EMP"
I am executing the folowing code:

Dim ds As DataSet = New DataSet("PluImages")
Dim da As OleDbDataAdapter = New OleDbDataAdapter()

da.Fill(ds, rsImages, "PluImages")
ds.WriteXml("PluImages.xsd")

After this I am able to get the DataSet to use in my Crystal Report in
VB.NET 2002 as the report source/data source.

But if I Open the xsd file I get an error "Document Element Must be a
schema".

Can anybody help me to do so. I have to use a dataset for my report by my
dataset is filled from a recordset.

Thanks
Prabhat

"Ravikanth[MVP]" <(E-Mail Removed)> wrote in message
news:0df701c37e9c$efb23f20$(E-Mail Removed)...
> Hi
>
> Hi,
>
> Yes, you can convert an ADO Recordset into an ADO.NET
> Dataset. You can
> use the OleDbDataAdapter to get rows from an
> ADODB.Recordset and the
> ADODB.Record and put them in a DataSet.
>
> The following C# code using System.Data.OleDb namespace
> will accomplish
> this.
>
> {
> //Code creates an ADODB Recordset using the Northwind.mdb
> database.
> //You will need to change the path to point to the
> database on
> your system.
> //You could also be using a recordset returned from
> another
> location or Component
>
> ADODB.Recordset MyRs= new ADODB.Recordset();
> ADODB.Connection MyCn = new ADODB.Connection();
>
> MyCn.Open("Provider=Microsoft.Jet.OLEDB.4.0;data
> source=D:\\Northwind.mdb","Admin","",0);
> MyRs.Open("Select * from
> Customers",MyCn,ADODB.CursorTypeEnum.adOpenStatic,
> ADODB.LockTypeEnum.adLockOptimistic,0);
>
> //Create and fill the dataset from the recordset and
> populate
> grid from Dataset.
> OleDbDataAdapter myDA = new OleDbDataAdapter();
> DataSet myDS = new DataSet("MyTable");
> myDA.Fill(myDS, MyRs, "MyTable");
>
> dataGrid1.DataSource = myDS;
> dataGrid1.DataMember="MyTAble";
>
> //Close and destroy ADODB Objects
> //Note that the OleDbDataAdapter.Fill overload that takes
> //a DataTable and an ADO object implicitly calls Close on
> //the ADO object when the Fill operation is complete.
>
> MyCn.Close();
> }
>
> Hope this information is helpful.
>
>
> Ravikanth[MVP]
>
>
> >-----Original Message-----
> >Hi
> >
> >I am using a VB6 client which connects to a web service

> using soap3.0
> >The client is querying a MSDE and filling up a

> ADODB.recordset. What I
> >am trying to acomplish is to send this recordset to the

> web service
> >where it will be inserted into another MSDE. Much like a

> batch job.
> >
> >The client
> >---------------------------------------------------------

> ----------------
> >Dim r As ADODB.Recordset
> >Dim xml as string
> >Set r = m_us.db.connection1.Execute("Select * from

> status") 'Get a
> >recordset from an ado wrapper
> >
> >r.Save "c:\doit.xml", adPersistXML ' Save the recordset

> to disk in XML
> >format
> >xml=readXmlFromDisk()'Read the xml from disk into a

> string
> >
> >m_service.uploadData(xml)'Use soap to send the string to

> the
> >webservice
> >
> >The web service using C#
> >---------------------------------------------------------

> -----------------
> >[WebMethod]
> >public bool uploadData(string data)
> >{
> >//How do I grab the xml string and insert the data into

> a table?
> >//My best suggestion is to convert the XML string into a

> dataset(don`t
> >know how)
> >//and save this dataset into the MSDE
> >}
> >
> >
> >Thanks
> >
> >Tor Christian
> >.
> >



 
Reply With Quote
 
Prabhat
Guest
Posts: n/a
 
      19th Sep 2003
Hi All.

Sorry! I Got that
That should be

ds.WriteXmlSchema("PluImages.xsd")

Thanks
Prabhat

"Prabhat" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi,
>
> I have a ADO Recordset (rsImages) which is having "Select * FROM EMP"
> I am executing the folowing code:
>
> Dim ds As DataSet = New DataSet("PluImages")
> Dim da As OleDbDataAdapter = New OleDbDataAdapter()
>
> da.Fill(ds, rsImages, "PluImages")
> ds.WriteXml("PluImages.xsd")
>
> After this I am able to get the DataSet to use in my Crystal Report in
> VB.NET 2002 as the report source/data source.
>
> But if I Open the xsd file I get an error "Document Element Must be a
> schema".
>
> Can anybody help me to do so. I have to use a dataset for my report by my
> dataset is filled from a recordset.
>
> Thanks
> Prabhat
>
> "Ravikanth[MVP]" <(E-Mail Removed)> wrote in message
> news:0df701c37e9c$efb23f20$(E-Mail Removed)...
> > Hi
> >
> > Hi,
> >
> > Yes, you can convert an ADO Recordset into an ADO.NET
> > Dataset. You can
> > use the OleDbDataAdapter to get rows from an
> > ADODB.Recordset and the
> > ADODB.Record and put them in a DataSet.
> >
> > The following C# code using System.Data.OleDb namespace
> > will accomplish
> > this.
> >
> > {
> > //Code creates an ADODB Recordset using the Northwind.mdb
> > database.
> > //You will need to change the path to point to the
> > database on
> > your system.
> > //You could also be using a recordset returned from
> > another
> > location or Component
> >
> > ADODB.Recordset MyRs= new ADODB.Recordset();
> > ADODB.Connection MyCn = new ADODB.Connection();
> >
> > MyCn.Open("Provider=Microsoft.Jet.OLEDB.4.0;data
> > source=D:\\Northwind.mdb","Admin","",0);
> > MyRs.Open("Select * from
> > Customers",MyCn,ADODB.CursorTypeEnum.adOpenStatic,
> > ADODB.LockTypeEnum.adLockOptimistic,0);
> >
> > //Create and fill the dataset from the recordset and
> > populate
> > grid from Dataset.
> > OleDbDataAdapter myDA = new OleDbDataAdapter();
> > DataSet myDS = new DataSet("MyTable");
> > myDA.Fill(myDS, MyRs, "MyTable");
> >
> > dataGrid1.DataSource = myDS;
> > dataGrid1.DataMember="MyTAble";
> >
> > //Close and destroy ADODB Objects
> > //Note that the OleDbDataAdapter.Fill overload that takes
> > //a DataTable and an ADO object implicitly calls Close on
> > //the ADO object when the Fill operation is complete.
> >
> > MyCn.Close();
> > }
> >
> > Hope this information is helpful.
> >
> >
> > Ravikanth[MVP]
> >
> >
> > >-----Original Message-----
> > >Hi
> > >
> > >I am using a VB6 client which connects to a web service

> > using soap3.0
> > >The client is querying a MSDE and filling up a

> > ADODB.recordset. What I
> > >am trying to acomplish is to send this recordset to the

> > web service
> > >where it will be inserted into another MSDE. Much like a

> > batch job.
> > >
> > >The client
> > >---------------------------------------------------------

> > ----------------
> > >Dim r As ADODB.Recordset
> > >Dim xml as string
> > >Set r = m_us.db.connection1.Execute("Select * from

> > status") 'Get a
> > >recordset from an ado wrapper
> > >
> > >r.Save "c:\doit.xml", adPersistXML ' Save the recordset

> > to disk in XML
> > >format
> > >xml=readXmlFromDisk()'Read the xml from disk into a

> > string
> > >
> > >m_service.uploadData(xml)'Use soap to send the string to

> > the
> > >webservice
> > >
> > >The web service using C#
> > >---------------------------------------------------------

> > -----------------
> > >[WebMethod]
> > >public bool uploadData(string data)
> > >{
> > >//How do I grab the xml string and insert the data into

> > a table?
> > >//My best suggestion is to convert the XML string into a

> > dataset(don`t
> > >know how)
> > >//and save this dataset into the MSDE
> > >}
> > >
> > >
> > >Thanks
> > >
> > >Tor Christian
> > >.
> > >

>
>



 
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
Dataset to ADODB.Recordset Katit Microsoft C# .NET 3 11th Sep 2007 05:00 PM
Open persisted ADODB recordset in ADO.Net DataSet Dan Reber Microsoft ADO .NET 6 29th Jan 2007 01:16 PM
help convert DAO.Recordset to ADODB.Recordset =?Utf-8?B?Uk5VU1pAT0tEUFM=?= Microsoft Access Forms 1 27th Feb 2005 07:51 PM
how to convert excel.worksheet.range into adodb.recordset? Mirco Wilhelm Microsoft Access 0 13th Nov 2003 09:27 AM
Convert Dataset to ADODB.Recordset luis ugaz Microsoft ADO .NET 0 15th Sep 2003 04:50 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:36 AM.