473,398 Members | 2,389 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

DataSet to MDB file

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!
Nov 21 '05 #1
5 8531
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
Nov 21 '05 #2
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" <PJ*****@discussions.microsoft.com> wrote in message
news:8A**********************************@microsof t.com...
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!

Nov 21 '05 #3
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" <PJ*****@discussions.microsoft.com> wrote in message
news:8A**********************************@microsof t.com...
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!


Nov 21 '05 #4
On Thu, 21 Apr 2005 07:15:04 -0700, "PJSimon" <PJ*****@discussions.microsoft.com> 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)
Nov 21 '05 #5
That's the ticket! Thank you!
Nov 21 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Deepa | last post by:
Hi I have a DataSet file (xml) which I need to convert it into a tab delimited file. I need to write a C# console application for doing the same. Can anyone help me out with the code to do it? I'd...
3
by: Bill C. | last post by:
Hi, I've got a simple console app that just reads an XML file into a DataSet then prints out a description of each table in the DataSet, including column names and row values for each column. ...
10
by: andrewcw | last post by:
I read in a earlier post that I can get the column of a grid to sort by datetime if the column type was set as Date I deserialize my XML and one attribute of the XSD has type as dateTime but upon...
7
by: Sharon | last post by:
I have successfully loaded a DataSet object with a XML schema (XSD). Now I wish to populate the tables that was created in the DataSet. I have an XML file/string that contain all the needed data...
4
by: Sindarian | last post by:
This just seems like the most basic thing, but I can't find a simple description of this process anywhere and in here, everone is talking about going the other way :( I had .NET create an XML...
8
by: GaryDean | last post by:
In an 2.0 asp app I used vs.net 2005 to create a TableAdapter:Dataset in my App_code directory. I also created a new vb class in that same directory. I have two issues: 1. I notice that there...
3
by: David P. Donahue | last post by:
I'm re-writing an application in C# that was originally written in Delphi 7. The heart of the application is a DataSet displayed in a DataGrid. One of the main functions of the previous...
4
by: Al | last post by:
I have this scenario: 1. XML file with schema and data is created from SQL Server tables. XML file contains 6 tables, some of them have rows, some of them are empty. 2. XML file is given to the...
4
by: Justin | last post by:
I'm just learning ASP.NET 2.0 and everything I find on Datasets including the MSPress book I bought go way to far for what I need. I do not need to bind a datasource. My source will be a text...
2
by: ERingmae | last post by:
Hi, The environment is .NET 2.0, the language is C# and the problem is reading XSD file with xs:redefine section correctly to a XMLDataDocument.DataSet. What I am trying to do: I am trying...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.