PC Review


Reply
Thread Tools Rate Thread

DataSet to MDB file

 
 
=?Utf-8?B?UEpTaW1vbg==?=
Guest
Posts: n/a
 
      20th Apr 2005
I know that I can export a DataSet to XML. How can I save the DataSet to a
Microsoft Access MDB file?

Could you provide some sample code if it's a tough solution, please?

Thanks in advance!
 
Reply With Quote
 
 
 
 
Cor Ligthert
Guest
Posts: n/a
 
      21st Apr 2005
PJSimon,

You have to create your own table and columns using the SQL CREATE
statemenent and the command.executenonquery.

Than you can, when your rowstate are everywhere added, insert the dataset
using the insert command (eventually made by the commandbuilder) into your
access dataset.

I hope this helps,

Cor


 
Reply With Quote
 
Doug Bell
Guest
Posts: n/a
 
      21st Apr 2005
PJS,

You need to connect to the Access DB, then itterate through the DataSet and
append the records to the Access Table.
It can get a bit trickier if you need to check if the record has already
been appended and it needs to be updated.

I could not find the code for when I needed to do that but I used ADO to
delete old recoreds, update existing and append new.

SQL= "INSERT INTO tblMyTable (FieldA, FieldB) " & _
"VALUES (" & ValueA & ", " & ValueB") "

Doug

"PJSimon" <(E-Mail Removed)> wrote in message
news:8AFB4310-B273-410A-B905-(E-Mail Removed)...
> I know that I can export a DataSet to XML. How can I save the DataSet to

a
> Microsoft Access MDB file?
>
> Could you provide some sample code if it's a tough solution, please?
>
> Thanks in advance!



 
Reply With Quote
 
=?Utf-8?B?UEpTaW1vbg==?=
Guest
Posts: n/a
 
      21st Apr 2005
Thanks for the help, guys, but it's still not working I'm stuck in
establishing the connection to the database.

I'm using:

Private ConnectionString As String = "Server=local;" & _
"Database=SampleDB;" & _
"Integrated Security=SSPI;"
Dim scnnDatabase As New SqlConnection(ConnectionString)

Try
scnnDatabase.Open()
Catch ex As SqlException
MessageBox.Show(ex.ToString)
Exit Sub
End Try

... to establish my connection to the MDB file, but when I try to open the
connection, I get an error:

"SQL Server does not exist or access denied."
(I have set up an MDB connection in ODBC that points to the SampleDB.MDB
file.)

I have been researching this on the Internet and I'm starting to think I
need to download some plugin from Microsoft, but I dunno if that plugin
pertains to this issue. Can you help?


"Doug Bell" wrote:

> PJS,
>
> You need to connect to the Access DB, then itterate through the DataSet and
> append the records to the Access Table.
> It can get a bit trickier if you need to check if the record has already
> been appended and it needs to be updated.
>
> I could not find the code for when I needed to do that but I used ADO to
> delete old recoreds, update existing and append new.
>
> SQL= "INSERT INTO tblMyTable (FieldA, FieldB) " & _
> "VALUES (" & ValueA & ", " & ValueB") "
>
> Doug
>
> "PJSimon" <(E-Mail Removed)> wrote in message
> news:8AFB4310-B273-410A-B905-(E-Mail Removed)...
> > I know that I can export a DataSet to XML. How can I save the DataSet to

> a
> > Microsoft Access MDB file?
> >
> > Could you provide some sample code if it's a tough solution, please?
> >
> > Thanks in advance!

>
>
>

 
Reply With Quote
 
Paul Clement
Guest
Posts: n/a
 
      21st Apr 2005
On Thu, 21 Apr 2005 07:15:04 -0700, "PJSimon" <(E-Mail Removed)> wrote:

¤ Thanks for the help, guys, but it's still not working I'm stuck in
¤ establishing the connection to the database.
¤
¤ I'm using:
¤
¤ Private ConnectionString As String = "Server=local;" & _
¤ "Database=SampleDB;" & _
¤ "Integrated Security=SSPI;"
¤ Dim scnnDatabase As New SqlConnection(ConnectionString)
¤

You need to use the OLEDB provider instead:

ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=e:\My Documents\db1.mdb"

Dim AccessConnection As New System.Data.OleDb.OleDbConnection(ConnectionString)
AccessConnection.Open()


Paul
~~~~
Microsoft MVP (Visual Basic)
 
Reply With Quote
 
=?Utf-8?B?UEpTaW1vbg==?=
Guest
Posts: n/a
 
      21st Apr 2005
That's the ticket! Thank you!
 
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 XSD file Dragon Microsoft C# .NET 1 24th Feb 2006 03:48 AM
Dataset to CSV file =?Utf-8?B?QnJpYW5ESA==?= Microsoft VB .NET 4 5th Aug 2005 06:02 PM
CSV file into dataset EMW Microsoft Dot NET 3 22nd Feb 2004 05:51 PM
How can I create an xsd file out of a Dataset class file? Babu Mannaravalappil Microsoft ADO .NET 1 4th Aug 2003 12:44 AM
Converting Dataset to a .IND file( dbaseIV index file) Hari Microsoft ADO .NET 0 12th Jul 2003 11:02 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:00 AM.