Reputation: 97
I'm using MS Access as my database, my hosting is not supporting this, and I need to know how to convert MS Access to SQL Server connection string?
This my code of data connection:
'--------------- ole parameters -------------------
Dim olecommand As Data.OleDb.OleDbCommand
Dim oledataadaptor As Data.OleDb.OleDbDataAdapter
Dim odbcDataSet As System.Data.DataSet
Sub populate_dataset_Access_accdb_test(ByRef ds As DataSet, ByVal sql As String)
Dim myDataConnection As New OleDbConnection(ConfigurationManager.ConnectionStrings("myodbc").ConnectionString)
olecommand = New OleDb.OleDbCommand
olecommand.CommandText = sql
odbcDataSet = New System.Data.DataSet
olecommand.Connection = myDataConnection
myDataConnection.Open()
oledataadaptor = New OleDbDataAdapter(sql, myDataConnection)
oledataadaptor.Fill(ds)
myDataConnection.Close()
End Sub
Sub insert_dataset_Access_accdb_test(ByVal sql As String)
Dim myDataConnection As New OleDbConnection(ConfigurationManager.ConnectionStrings("myodbc").ConnectionString)
olecommand = New OleDb.OleDbCommand
olecommand.CommandText = sql
odbcDataSet = New System.Data.DataSet
olecommand.Connection = myDataConnection
myDataConnection.Open()
olecommand = New OleDbCommand(sql, myDataConnection)
olecommand.ExecuteNonQuery()
myDataConnection.Close()
End Sub
Sub cr_ds(ByRef ds As DataSet, ByVal sql As String, ByVal tablename As String)
Dim myDataConnection As New OleDbConnection(ConfigurationManager.ConnectionStrings("myodbc").ConnectionString)
olecommand = New OleDb.OleDbCommand
olecommand.CommandText = sql
odbcDataSet = New System.Data.DataSet
olecommand.Connection = myDataConnection
myDataConnection.Open()
oledataadaptor = New OleDbDataAdapter(sql, myDataConnection)
oledataadaptor.Fill(ds, tablename)
myDataConnection.Close()
End Sub
Thank you in advance
Upvotes: 0
Views: 672
Reputation: 5369
As Steve Wellens pointed out, you miss some basic things here. Since your host does not support your data source type (MS Access), changing your connection string is not enough. You have to use a data store supported by your hosting service. I suppose that Microsoft SQL Server is one of them, but you have to verify it by contacting your hosting service administration support.
Regarding the transfer of data between MS Access and MS SQL Server, you could get some guidance here.
Regarding the MS SQL Server connection strings, you could get some help from this post but you have to verify the availability of the MS SQL Server database with your hosting service.
Hope I helped!
Upvotes: 1
Reputation: 20640
You can't just change an Access connection string to an SQL connection string and have things work. You would have to port your data From Access to the SQL Server.
I think it is more likely that when you deploy your Access database to the server, the path is different. You probably need to modify the config file to point to to where the Access file is on the server.
Upvotes: 0