Home > Article > Computer Tutorials > How to transfer local SQL database to remote SQL using VB
Make sure your space has a data service connection
Source error:
Line 29: ConnectionStringSettings setting = System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionString"];
Line 30: myCon.ConnectionString = setting.ConnectionString;
Line 31: myCon.Open();
Line 32:
Line 33: //2 Use SqlCommand to submit query command
Source file: d:\root\3g1008688_com\web\Default2.aspx.cs Line: 31
Your file here is not uploaded to the server, recheck whether the database operation file is uploaded completely
Imports System.Data
Imports System.Data.SqlClient
Module connect to database
Public Server1 As String
Public DataBase1 As String
Public Function GetTable(ByVal sqlstr$) As DataTable
Dim SqlConn As SqlConnection = New SqlConnection("server=" & Server1 & ";database="" & DataBase1 & ";integrated security=true") 'Declare these SQL classes
Dim facDataAdapter As SqlDataAdapter = New SqlDataAdapter
Dim SqlComm As SqlCommand = New SqlCommand(sqlstr, SqlConn)
facDataAdapter.SelectCommand = SqlComm
Dim dt As DataTable = New DataTable
facDataAdapter.Fill(dt)
Return dt
End Function
End Module
The above is the detailed content of How to transfer local SQL database to remote SQL using VB. For more information, please follow other related articles on the PHP Chinese website!