473,379 Members | 1,220 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,379 software developers and data experts.

Vb newb needs help on data import/export

Hello everyone,

im completly new to vb.net and I was assigned to do a simple piece of
software that just had to select from um db in a MS access data base
and insert into a SQL server Database. The structure tables are
exactly the same so there's no need in data conversation.

My idea was to fill a datatable with the results from my
oledbdataadapter and then use that dataset to update on my
sqldataadapterm, however I cant find the way to specify the connection
string to my sqldataadapter to my SQL database. Probably this is not
the best way to achieve this but got this idea from this link:
http://www.dotnet247.com/247referenc...40/203742.aspx where this
guys is trying to do exactly the same thing I want.

My code looks like this.

Dim strConn = "Provider=Microsoft.Jet.OleDb.4.0;Data Source=" &
Application.StartupPath & "\sapo.mdb"
Dim cnConn As New OleDbConnection(strConn)
Dim accessAdapter As New OleDbDataAdapter("select * from
transactions", cnConn)
Dim dtAccessData As New DataTable
accessAdapter.Fill(dtAccessData)
Dim sqlAdapter As New SqlDataAdapter
sqlAdapter.Update(dtAccessData)

Perhaps some sugestion how to put this code working or some other
sugestion how to achieve this goal by any other way.

Any help is highly appreciated

Thanks in advance

Joao

Sep 28 '07 #1
12 1987
On Sep 28, 7:40 am, joaotsetsemo...@gmail.com wrote:
Hello everyone,

im completly new to vb.net and I was assigned to do a simple piece of
software that just had to select from um db in a MS access data base
and insert into a SQL server Database. The structure tables are
exactly the same so there's no need in data conversation.

My idea was to fill a datatable with the results from my
oledbdataadapter and then use that dataset to update on my
sqldataadapterm, however I cant find the way to specify the connection
string to my sqldataadapter to my SQL database. Probably this is not
the best way to achieve this but got this idea from this link:http://www.dotnet247.com/247referenc...3742.aspxwhere this
guys is trying to do exactly the same thing I want.

My code looks like this.

Dim strConn = "Provider=Microsoft.Jet.OleDb.4.0;Data Source=" &
Application.StartupPath & "\sapo.mdb"
Dim cnConn As New OleDbConnection(strConn)
Dim accessAdapter As New OleDbDataAdapter("select * from
transactions", cnConn)
Dim dtAccessData As New DataTable
accessAdapter.Fill(dtAccessData)
Dim sqlAdapter As New SqlDataAdapter
sqlAdapter.Update(dtAccessData)

Perhaps some sugestion how to put this code working or some other
sugestion how to achieve this goal by any other way.

Any help is highly appreciated

Thanks in advance

Joao
You have the correct idea already, but you need to make a separate
dbConnection for the sqlAdapter.

Dim strConn = "Provider=Microsoft.Jet.OleDb.4.0;Data Source=" &
Application.StartupPath & "\sapo.mdb"
Dim cnConn As New OleDbConnection(strConn)
Dim accessAdapter As New OleDbDataAdapter("select * from
transactions", cnConn)
Dim dtAccessData As New DataTable
accessAdapter.Fill(dtAccessData)
cnConn.Close()
accessAdapter.Dispose()
cnConn.Dispose()

Dim sqlConnString as String = "YOUR SQL CONNECTION STRING HERE"
Dim dbConn as New SqlClient.SqlConnection(sqlConnString)
Dim dbCmd as New SqlClient.SqlCommand("INSERT SQL STATEMENT", dbConn)
Dim sqlAdapter As New SqlDataAdapter(dbCmd)
sqlAdapter.Update(dtAccessData)
dbConn.Close()
sqlAdapter.Dispose()
dbCmd.Dispose()
dbConn.Dispose()

Look at the additional lines of code, its a down and dirty version,
and could be cleaner but should get you going. Always remember to
close your connections and dispose of objects that implement
iDisposable.

Sep 28 '07 #2
On Sep 28, 9:01 am, Charlie Brown <cbr...@duclaw.comwrote:
On Sep 28, 7:40 am, joaotsetsemo...@gmail.com wrote:
Hello everyone,
im completly new to vb.net and I was assigned to do a simple piece of
software that just had to select from um db in a MS access data base
and insert into a SQL server Database. The structure tables are
exactly the same so there's no need in data conversation.
My idea was to fill a datatable with the results from my
oledbdataadapter and then use that dataset to update on my
sqldataadapterm, however I cant find the way to specify the connection
string to my sqldataadapter to my SQL database. Probably this is not
the best way to achieve this but got this idea from this link:http://www.dotnet247.com/247referenc....aspxwherethis
guys is trying to do exactly the same thing I want.
My code looks like this.
Dim strConn = "Provider=Microsoft.Jet.OleDb.4.0;Data Source=" &
Application.StartupPath & "\sapo.mdb"
Dim cnConn As New OleDbConnection(strConn)
Dim accessAdapter As New OleDbDataAdapter("select * from
transactions", cnConn)
Dim dtAccessData As New DataTable
accessAdapter.Fill(dtAccessData)
Dim sqlAdapter As New SqlDataAdapter
sqlAdapter.Update(dtAccessData)
Perhaps some sugestion how to put this code working or some other
sugestion how to achieve this goal by any other way.
Any help is highly appreciated
Thanks in advance
Joao

You have the correct idea already, but you need to make a separate
dbConnection for the sqlAdapter.

Dim strConn = "Provider=Microsoft.Jet.OleDb.4.0;Data Source=" &
Application.StartupPath & "\sapo.mdb"
Dim cnConn As New OleDbConnection(strConn)
Dim accessAdapter As New OleDbDataAdapter("select * from
transactions", cnConn)
Dim dtAccessData As New DataTable
accessAdapter.Fill(dtAccessData)
cnConn.Close()
accessAdapter.Dispose()
cnConn.Dispose()

Dim sqlConnString as String = "YOUR SQL CONNECTION STRING HERE"
Dim dbConn as New SqlClient.SqlConnection(sqlConnString)
Dim dbCmd as New SqlClient.SqlCommand("INSERT SQL STATEMENT", dbConn)
Dim sqlAdapter As New SqlDataAdapter(dbCmd)
sqlAdapter.Update(dtAccessData)
dbConn.Close()
sqlAdapter.Dispose()
dbCmd.Dispose()
dbConn.Dispose()
Remember to open those connection objects first.... :-)
Look at the additional lines of code, its a down and dirty version,
and could be cleaner but should get you going. Always remember to
close your connections and dispose of objects that implement
iDisposable.
I would also recommend either wrapping the methods in a Using block or
using try...finally structure to make sure the Db objects get
disposed. Also, IIRC, closing the connection is unnecessary if you are
calling Dispose.

Thanks,

Seth Rowe
Sep 28 '07 #3
On Sep 28, 2:25 pm, rowe_newsgroups <rowe_em...@yahoo.comwrote:
On Sep 28, 9:01 am, Charlie Brown <cbr...@duclaw.comwrote:


On Sep 28, 7:40 am, joaotsetsemo...@gmail.com wrote:
Hello everyone,
im completly new to vb.net and I was assigned to do a simple piece of
software that just had to select from um db in a MS access data base
and insert into a SQL server Database. The structure tables are
exactly the same so there's no need in data conversation.
My idea was to fill a datatable with the results from my
oledbdataadapter and then use that dataset to update on my
sqldataadapterm, however I cant find the way to specify the connection
string to my sqldataadapter to my SQL database. Probably this is not
the best way to achieve this but got this idea from this link:http://www.dotnet247.com/247referenc....aspxwherethis
guys is trying to do exactly the same thing I want.
My code looks like this.
Dim strConn = "Provider=Microsoft.Jet.OleDb.4.0;Data Source=" &
Application.StartupPath & "\sapo.mdb"
Dim cnConn As New OleDbConnection(strConn)
Dim accessAdapter As New OleDbDataAdapter("select * from
transactions", cnConn)
Dim dtAccessData As New DataTable
accessAdapter.Fill(dtAccessData)
Dim sqlAdapter As New SqlDataAdapter
sqlAdapter.Update(dtAccessData)
Perhaps some sugestion how to put this code working or some other
sugestion how to achieve this goal by any other way.
Any help is highly appreciated
Thanks in advance
Joao
You have the correct idea already, but you need to make a separate
dbConnection for the sqlAdapter.
Dim strConn = "Provider=Microsoft.Jet.OleDb.4.0;Data Source=" &
Application.StartupPath & "\sapo.mdb"
Dim cnConn As New OleDbConnection(strConn)
Dim accessAdapter As New OleDbDataAdapter("select * from
transactions", cnConn)
Dim dtAccessData As New DataTable
accessAdapter.Fill(dtAccessData)
cnConn.Close()
accessAdapter.Dispose()
cnConn.Dispose()
Dim sqlConnString as String = "YOUR SQL CONNECTION STRING HERE"
Dim dbConn as New SqlClient.SqlConnection(sqlConnString)
Dim dbCmd as New SqlClient.SqlCommand("INSERT SQL STATEMENT", dbConn)
Dim sqlAdapter As New SqlDataAdapter(dbCmd)
sqlAdapter.Update(dtAccessData)
dbConn.Close()
sqlAdapter.Dispose()
dbCmd.Dispose()
dbConn.Dispose()

Remember to open those connection objects first.... :-)
Look at the additional lines of code, its a down and dirty version,
and could be cleaner but should get you going. Always remember to
close your connections and dispose of objects that implement
iDisposable.

I would also recommend either wrapping the methods in a Using block or
using try...finally structure to make sure the Db objects get
disposed. Also, IIRC, closing the connection is unnecessary if you are
calling Dispose.

Thanks,

Seth Rowe- Hide quoted text -

- Show quoted text -
Thanks for your replies, I will try that however something is still
missing me.

If in the first piece of code I assign all the results of the "select
* from transactions" to a datatable, why do I need an insert and how
is gonna be that insert, in the second piece of code? Can't I just
pick the datatable and roughly insert it in the SQL server data base
using the sqldataadapter.update?

Sep 28 '07 #4
Just a quick FYI...
There is a data import thru the SQL Server.
In SQL Server 2005 it calls it ""SSIS" "SQL Sever Integration Services".
It is launched form the same SQL Server Management Studio database
"Tasks" option.
Apparently the option is very simple and intuitive.

Might save you a lot of time.

I have never used this ..but i pulled this out of the book I'm reading.

M.
jo*************@gmail.com wrote:
On Sep 28, 2:25 pm, rowe_newsgroups <rowe_em...@yahoo.comwrote:
>On Sep 28, 9:01 am, Charlie Brown <cbr...@duclaw.comwrote:


>>On Sep 28, 7:40 am, joaotsetsemo...@gmail.com wrote:
Hello everyone,
im completly new to vb.net and I was assigned to do a simple piece of
software that just had to select from um db in a MS access data base
and insert into a SQL server Database. The structure tables are
exactly the same so there's no need in data conversation.
My idea was to fill a datatable with the results from my
oledbdataadapter and then use that dataset to update on my
sqldataadapterm, however I cant find the way to specify the connection
string to my sqldataadapter to my SQL database. Probably this is not
the best way to achieve this but got this idea from this link:http://www.dotnet247.com/247referenc....aspxwherethis
guys is trying to do exactly the same thing I want.
My code looks like this.
Dim strConn = "Provider=Microsoft.Jet.OleDb.4.0;Data Source=" &
Application.StartupPath & "\sapo.mdb"
Dim cnConn As New OleDbConnection(strConn)
Dim accessAdapter As New OleDbDataAdapter("select * from
transactions", cnConn)
Dim dtAccessData As New DataTable
accessAdapter.Fill(dtAccessData)
Dim sqlAdapter As New SqlDataAdapter
sqlAdapter.Update(dtAccessData)
Perhaps some sugestion how to put this code working or some other
sugestion how to achieve this goal by any other way.
Any help is highly appreciated
Thanks in advance
Joao
You have the correct idea already, but you need to make a separate
dbConnection for the sqlAdapter.
Dim strConn = "Provider=Microsoft.Jet.OleDb.4.0;Data Source=" &
Application.StartupPath & "\sapo.mdb"
Dim cnConn As New OleDbConnection(strConn)
Dim accessAdapter As New OleDbDataAdapter("select * from
transactions", cnConn)
Dim dtAccessData As New DataTable
accessAdapter.Fill(dtAccessData)
cnConn.Close()
accessAdapter.Dispose()
cnConn.Dispose()
Dim sqlConnString as String = "YOUR SQL CONNECTION STRING HERE"
Dim dbConn as New SqlClient.SqlConnection(sqlConnString)
Dim dbCmd as New SqlClient.SqlCommand("INSERT SQL STATEMENT", dbConn)
Dim sqlAdapter As New SqlDataAdapter(dbCmd)
sqlAdapter.Update(dtAccessData)
dbConn.Close()
sqlAdapter.Dispose()
dbCmd.Dispose()
dbConn.Dispose()
Remember to open those connection objects first.... :-)
>>Look at the additional lines of code, its a down and dirty version,
and could be cleaner but should get you going. Always remember to
close your connections and dispose of objects that implement
iDisposable.
I would also recommend either wrapping the methods in a Using block or
using try...finally structure to make sure the Db objects get
disposed. Also, IIRC, closing the connection is unnecessary if you are
calling Dispose.

Thanks,

Seth Rowe- Hide quoted text -

- Show quoted text -

Thanks for your replies, I will try that however something is still
missing me.

If in the first piece of code I assign all the results of the "select
* from transactions" to a datatable, why do I need an insert and how
is gonna be that insert, in the second piece of code? Can't I just
pick the datatable and roughly insert it in the SQL server data base
using the sqldataadapter.update?
Sep 28 '07 #5
On Sep 28, 2:52 pm, Miro <miron...@beero.netwrote:
Just a quick FYI...
There is a data import thru the SQL Server.
In SQL Server 2005 it calls it ""SSIS" "SQL Sever Integration Services".
It is launched form the same SQL Server Management Studio database
"Tasks" option.
Apparently the option is very simple and intuitive.

Might save you a lot of time.

I have never used this ..but i pulled this out of the book I'm reading.

M.

joaotsetsemo...@gmail.com wrote:
On Sep 28, 2:25 pm, rowe_newsgroups <rowe_em...@yahoo.comwrote:
On Sep 28, 9:01 am, Charlie Brown <cbr...@duclaw.comwrote:
>On Sep 28, 7:40 am, joaotsetsemo...@gmail.com wrote:
Hello everyone,
im completly new to vb.net and I was assigned to do a simple piece of
software that just had to select from um db in a MS access data base
and insert into a SQL server Database. The structure tables are
exactly the same so there's no need in data conversation.
My idea was to fill a datatable with the results from my
oledbdataadapter and then use that dataset to update on my
sqldataadapterm, however I cant find the way to specify the connection
string to my sqldataadapter to my SQL database. Probably this is not
the best way to achieve this but got this idea from this link:http://www.dotnet247.com/247referenc....aspxwherethis
guys is trying to do exactly the same thing I want.
My code looks like this.
Dim strConn = "Provider=Microsoft.Jet.OleDb.4.0;Data Source=" &
Application.StartupPath & "\sapo.mdb"
Dim cnConn As New OleDbConnection(strConn)
Dim accessAdapter As New OleDbDataAdapter("select * from
transactions", cnConn)
Dim dtAccessData As New DataTable
accessAdapter.Fill(dtAccessData)
Dim sqlAdapter As New SqlDataAdapter
sqlAdapter.Update(dtAccessData)
Perhaps some sugestion how to put this code working or some other
sugestion how to achieve this goal by any other way.
Any help is highly appreciated
Thanks in advance
Joao
You have the correct idea already, but you need to make a separate
dbConnection for the sqlAdapter.
Dim strConn = "Provider=Microsoft.Jet.OleDb.4.0;Data Source=" &
Application.StartupPath & "\sapo.mdb"
Dim cnConn As New OleDbConnection(strConn)
Dim accessAdapter As New OleDbDataAdapter("select * from
transactions", cnConn)
Dim dtAccessData As New DataTable
accessAdapter.Fill(dtAccessData)
cnConn.Close()
accessAdapter.Dispose()
cnConn.Dispose()
Dim sqlConnString as String = "YOUR SQL CONNECTION STRING HERE"
Dim dbConn as New SqlClient.SqlConnection(sqlConnString)
Dim dbCmd as New SqlClient.SqlCommand("INSERT SQL STATEMENT", dbConn)
Dim sqlAdapter As New SqlDataAdapter(dbCmd)
sqlAdapter.Update(dtAccessData)
dbConn.Close()
sqlAdapter.Dispose()
dbCmd.Dispose()
dbConn.Dispose()
Remember to open those connection objects first.... :-)
>Look at the additional lines of code, its a down and dirty version,
and could be cleaner but should get you going. Always remember to
close your connections and dispose of objects that implement
iDisposable.
I would also recommend either wrapping the methods in a Using block or
using try...finally structure to make sure the Db objects get
disposed. Also, IIRC, closing the connection is unnecessary if you are
calling Dispose.
Thanks,
Seth Rowe- Hide quoted text -
- Show quoted text -
Thanks for your replies, I will try that however something is still
missing me.
If in the first piece of code I assign all the results of the "select
* from transactions" to a datatable, why do I need an insert and how
is gonna be that insert, in the second piece of code? Can't I just
pick the datatable and roughly insert it in the SQL server data base
using the sqldataadapter.update?- Hide quoted text -

- Show quoted text -
Hi Miro. Thanks for you tip but im using sql express 2005 which doesnt
have any import/export feature.

Anyway, I need to transfer data in a daily bases from an access DB to
a SQL db. This transfer will hapen when a new access db will be FTP to
the server every morning. Must be an automated system. That's why I
need to transfer the data using a VB program.

Sep 28 '07 #6
On Sep 28, 9:36 am, joaotsetsemo...@gmail.com wrote:
On Sep 28, 2:25 pm, rowe_newsgroups <rowe_em...@yahoo.comwrote:


On Sep 28, 9:01 am, Charlie Brown <cbr...@duclaw.comwrote:
On Sep 28, 7:40 am, joaotsetsemo...@gmail.com wrote:
Hello everyone,
im completly new to vb.net and I was assigned to do a simple piece of
software that just had to select from um db in a MS access data base
and insert into a SQL server Database. The structure tables are
exactly the same so there's no need in data conversation.
My idea was to fill a datatable with the results from my
oledbdataadapter and then use that dataset to update on my
sqldataadapterm, however I cant find the way to specify the connection
string to my sqldataadapter to my SQL database. Probably this is not
the best way to achieve this but got this idea from this link:http://www.dotnet247.com/247referenc....aspxwherethis
guys is trying to do exactly the same thing I want.
My code looks like this.
Dim strConn = "Provider=Microsoft.Jet.OleDb.4.0;Data Source=" &
Application.StartupPath & "\sapo.mdb"
Dim cnConn As New OleDbConnection(strConn)
Dim accessAdapter As New OleDbDataAdapter("select * from
transactions", cnConn)
Dim dtAccessData As New DataTable
accessAdapter.Fill(dtAccessData)
Dim sqlAdapter As New SqlDataAdapter
sqlAdapter.Update(dtAccessData)
Perhaps some sugestion how to put this code working or some other
sugestion how to achieve this goal by any other way.
Any help is highly appreciated
Thanks in advance
Joao
You have the correct idea already, but you need to make a separate
dbConnection for the sqlAdapter.
Dim strConn = "Provider=Microsoft.Jet.OleDb.4.0;Data Source=" &
Application.StartupPath & "\sapo.mdb"
Dim cnConn As New OleDbConnection(strConn)
Dim accessAdapter As New OleDbDataAdapter("select * from
transactions", cnConn)
Dim dtAccessData As New DataTable
accessAdapter.Fill(dtAccessData)
cnConn.Close()
accessAdapter.Dispose()
cnConn.Dispose()
Dim sqlConnString as String = "YOUR SQL CONNECTION STRING HERE"
Dim dbConn as New SqlClient.SqlConnection(sqlConnString)
Dim dbCmd as New SqlClient.SqlCommand("INSERT SQL STATEMENT", dbConn)
Dim sqlAdapter As New SqlDataAdapter(dbCmd)
sqlAdapter.Update(dtAccessData)
dbConn.Close()
sqlAdapter.Dispose()
dbCmd.Dispose()
dbConn.Dispose()
Remember to open those connection objects first.... :-)
Look at the additional lines of code, its a down and dirty version,
and could be cleaner but should get you going. Always remember to
close your connections and dispose of objects that implement
iDisposable.
I would also recommend either wrapping the methods in a Using block or
using try...finally structure to make sure the Db objects get
disposed. Also, IIRC, closing the connection is unnecessary if you are
calling Dispose.
Thanks,
Seth Rowe- Hide quoted text -
- Show quoted text -

Thanks for your replies, I will try that however something is still
missing me.

If in the first piece of code I assign all the results of the "select
* from transactions" to a datatable, why do I need an insert and how
is gonna be that insert, in the second piece of code? Can't I just
pick the datatable and roughly insert it in the SQL server data base
using the sqldataadapter.update?- Hide quoted text -

- Show quoted text -
The dataadapter will require that you provide it with an update or
insert command unless you use a CommandBuilder to create one from your
SQL SELECT statement.

To use a commandbuilder, check out the following article
http://msdn2.microsoft.com/en-us/lib...ndbuilder.aspx

Basically you give the Adapter a SELECT command, then call
CommandBuilder.GetUpdateCommand and will populate your dataadapter
with the correct information.

As per the comment from Seth, you will need to open the connection
first by calling dbConn.Open prior to the Update method. You do not
need to do that before the Fill method, as fill will open the
connection for you.

Sep 28 '07 #7
Joao,

You might be able to use the SqlBulkCopy class to accomplish this task.

Kerry Moorman
"jo*************@gmail.com" wrote:
Hello everyone,

im completly new to vb.net and I was assigned to do a simple piece of
software that just had to select from um db in a MS access data base
and insert into a SQL server Database. The structure tables are
exactly the same so there's no need in data conversation.

My idea was to fill a datatable with the results from my
oledbdataadapter and then use that dataset to update on my
sqldataadapterm, however I cant find the way to specify the connection
string to my sqldataadapter to my SQL database. Probably this is not
the best way to achieve this but got this idea from this link:
http://www.dotnet247.com/247referenc...40/203742.aspx where this
guys is trying to do exactly the same thing I want.

My code looks like this.

Dim strConn = "Provider=Microsoft.Jet.OleDb.4.0;Data Source=" &
Application.StartupPath & "\sapo.mdb"
Dim cnConn As New OleDbConnection(strConn)
Dim accessAdapter As New OleDbDataAdapter("select * from
transactions", cnConn)
Dim dtAccessData As New DataTable
accessAdapter.Fill(dtAccessData)
Dim sqlAdapter As New SqlDataAdapter
sqlAdapter.Update(dtAccessData)

Perhaps some sugestion how to put this code working or some other
sugestion how to achieve this goal by any other way.

Any help is highly appreciated

Thanks in advance

Joao

Sep 28 '07 #8
On Sep 28, 4:00 pm, Kerry Moorman
<KerryMoor...@discussions.microsoft.comwrote:
Joao,

You might be able to use the SqlBulkCopy class to accomplish this task.

Kerry Moorman

"joaotsetsemo...@gmail.com" wrote:
Hello everyone,
im completly new to vb.net and I was assigned to do a simple piece of
software that just had to select from um db in a MS access data base
and insert into a SQL server Database. The structure tables are
exactly the same so there's no need in data conversation.
My idea was to fill a datatable with the results from my
oledbdataadapter and then use that dataset to update on my
sqldataadapterm, however I cant find the way to specify the connection
string to my sqldataadapter to my SQL database. Probably this is not
the best way to achieve this but got this idea from this link:
http://www.dotnet247.com/247referenc...3742.aspxwhere this
guys is trying to do exactly the same thing I want.
My code looks like this.
Dim strConn = "Provider=Microsoft.Jet.OleDb.4.0;Data Source=" &
Application.StartupPath & "\sapo.mdb"
Dim cnConn As New OleDbConnection(strConn)
Dim accessAdapter As New OleDbDataAdapter("select * from
transactions", cnConn)
Dim dtAccessData As New DataTable
accessAdapter.Fill(dtAccessData)
Dim sqlAdapter As New SqlDataAdapter
sqlAdapter.Update(dtAccessData)
Perhaps some sugestion how to put this code working or some other
sugestion how to achieve this goal by any other way.
Any help is highly appreciated
Thanks in advance
Joao- Hide quoted text -

- Show quoted text -
I wanna to thank everyone who posted here to help me. I managed to
achieve my gold using Kerry's sugestion.

With the class SQLBulk (which is not recognized by inteli sense, I
dont know why) I could do exatcly what I was looking for.

Next task: put the program listening a directory for new .MDB files
and run automaticly.

Many thanks to everyone

Joao

Sep 28 '07 #9
Joao,

You probably already know this, but the FileSystemWatcher class will help
you accomplish that task.

Kerry Moorman
"jo*************@gmail.com" wrote:
>
Next task: put the program listening a directory for new .MDB files
and run automaticly.

Many thanks to everyone

Joao

Sep 28 '07 #10
Can't I just
pick the datatable and roughly insert it in the SQL server data base
using the sqldataadapter.update?
Yes as long as you use a connectionString

www.connectionstrings.com

And a SqlCommandbuilder to create the update SQL dynamicly

http://msdn2.microsoft.com/en-us/lib...ndbuilder.aspx

Cor

Sep 28 '07 #11
On Sep 28, 12:46 pm, Kerry Moorman
<KerryMoor...@discussions.microsoft.comwrote:
Joao,

You probably already know this, but the FileSystemWatcher class will help
you accomplish that task.

Kerry Moorman

"joaotsetsemo...@gmail.com" wrote:
Next task: put the program listening a directory for new .MDB files
and run automaticly.
Many thanks to everyone
Joao- Hide quoted text -

- Show quoted text -
Kerry,
SQLBulk was a great suggestion, didn't even cross my mind... really on
your game today.

Sep 28 '07 #12
Just a tip and you probably are already aware that any AutoIncrement field in
your Access database tables may cause you problems when trying to sync with
any similiar field in the Sql database.
--
Dennis in Houston
"jo*************@gmail.com" wrote:
On Sep 28, 4:00 pm, Kerry Moorman
<KerryMoor...@discussions.microsoft.comwrote:
Joao,

You might be able to use the SqlBulkCopy class to accomplish this task.

Kerry Moorman

"joaotsetsemo...@gmail.com" wrote:
Hello everyone,
im completly new to vb.net and I was assigned to do a simple piece of
software that just had to select from um db in a MS access data base
and insert into a SQL server Database. The structure tables are
exactly the same so there's no need in data conversation.
My idea was to fill a datatable with the results from my
oledbdataadapter and then use that dataset to update on my
sqldataadapterm, however I cant find the way to specify the connection
string to my sqldataadapter to my SQL database. Probably this is not
the best way to achieve this but got this idea from this link:
>http://www.dotnet247.com/247referenc...3742.aspxwhere this
guys is trying to do exactly the same thing I want.
My code looks like this.
Dim strConn = "Provider=Microsoft.Jet.OleDb.4.0;Data Source=" &
Application.StartupPath & "\sapo.mdb"
Dim cnConn As New OleDbConnection(strConn)
Dim accessAdapter As New OleDbDataAdapter("select * from
transactions", cnConn)
Dim dtAccessData As New DataTable
accessAdapter.Fill(dtAccessData)
Dim sqlAdapter As New SqlDataAdapter
sqlAdapter.Update(dtAccessData)
Perhaps some sugestion how to put this code working or some other
sugestion how to achieve this goal by any other way.
Any help is highly appreciated
Thanks in advance
Joao- Hide quoted text -
- Show quoted text -

I wanna to thank everyone who posted here to help me. I managed to
achieve my gold using Kerry's sugestion.

With the class SQLBulk (which is not recognized by inteli sense, I
dont know why) I could do exatcly what I was looking for.

Next task: put the program listening a directory for new .MDB files
and run automaticly.

Many thanks to everyone

Joao

Sep 29 '07 #13

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

Similar topics

5
by: Alexandre | last post by:
Hi, Im a newb to dev and python... my first sefl assigned mission was to read a pickled file containing a list with DB like data and convert this to MySQL... So i wrote my first module which...
4
by: rafeekb | last post by:
Hello All, Is there any way to export data in the IXF version 1 format from a DB2 v8.2 database ? The problem I am facing is to get the data from a v8.2 database which produces a version 2...
3
by: genojoe | last post by:
I have tried everything I can think of to move records from one Access database to another. It should not be that hard. Read on.... I have identical access mdb's. One contains data; one...
2
by: David Richards | last post by:
Hi, I was wondering if anyone could help me. I have DataSet that contains the following data tables Customers, Calls, Quotes, QuoteDetails, Competitors, Contacts, Notes, and I have setup...
3
by: Iavor Raytchev | last post by:
Hello, We a situation with a central database that contains the data that needs to be presented at N off-line terminals (N can be 5 000 can be 15 000). Each terminal presents unique data. The...
10
by: Niklas | last post by:
Hi Before I start coding I need to be sure that nobody else has not done it yet and that I can use it. I need an import utility which import data from Excel to a database or some object in...
29
by: jaysherby | last post by:
I'm new at Python and I need a little advice. Part of the script I'm trying to write needs to be aware of all the files of a certain extension in the script's path and all sub-directories. Can...
4
by: Max2006 | last post by:
Hi, We are developing a SQL server based asp.net application. As part of requirement we should allow users import/export some relational data through web user interface. We are investigation...
3
by: =?Utf-8?B?YzY3NjIyOA==?= | last post by:
Hi all, I have a question for you. I have a .csv file which has many lines of data. Each line has many data fields which are delimited by ",". Now I need to extract part of data from this...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.