J
joaotsetsemoita
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/247reference/msgs/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
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/247reference/msgs/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