Dim tableFileName As String = "D:\PharmaDbScript.sql" Dim tableText As String Dim srvMgmtServer As Server = New Server Dim srvConn As ServerConnection Dim osqlservers As String = oSQLConnection.ToString Dim objDB As Database = srvMgmtServer.Databases(osqlservers) srvConn = srvMgmtServer.ConnectionContext srvConn.ServerInstance = SQLServer srvConn.LoginSecure = False If srvConn.LoginSecure = False Then srvConn.Login = "id" srvConn.Password = "password" End If Using FileReader As New Microsoft.VisualBasic.FileIO.TextFieldParser(tableFileName) tableText = FileReader.ReadToEnd End Using If tableText <> "" Then objDB.ExecuteNonQuery(tableText) End If
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)