S
Sivakumar282000
Guest
Hi All,
I have custom application that unable to connect to database and giving error below. I am using SQl express with 2017 console. Let me know whether you need any more information to help me resolve this issues. Thanks.
Here is the code
Imports ADODB
Imports System.Data.OleDb
Imports System.IO
Imports System.Data
Public Class DatabaseCn
Public strDBDir As String
Public Cn As Connection
Public cmdSP As Command
Public Rst As Recordset
Public Rst1 As Recordset
Public Rst2 As Recordset
Public Rst3 As Recordset
Public da As OleDbDataAdapter
Public ds As DataSet
Public dt As DataTable
Public CnMode As Integer = ConnectModeEnum.adModeUnknown
Public cmdType As Integer = CommandTypeEnum.adCmdStoredProc
Public CnStr As String
Public Sql As String
Public Sub New()
Cn = New Connection
cmdSP = New Command
Rst = New Recordset
Rst1 = New Recordset
Rst2 = New Recordset
Rst3 = New Recordset
da = New OleDbDataAdapter
ds = New DataSet
dt = New DataTable
'***SQL***
'Cn.CursorLocation = CursorLocationEnum.adUseServer
Cn.CursorLocation = CursorLocationEnum.adUseClient
CnStr = "Provider=sqloledb; Data Source=" & objSQL.Server & "; Initial Catalog=" & objSQL.Database & "; " _
& "User ID=" & objSQL.UserID & "; Password=" & objSQL.UserPwd & ";"
End Sub
Public Sub Open()
Cn.Open(CnStr, objSQL.UserID, objSQL.UserPwd, CnMode)
End Sub
Public Sub Execute(ByVal strSql As String)
Rst = Cn.Execute(strSql)
End Sub
Public Sub Execute1(ByVal strSql As String)
Rst1 = Cn.Execute(strSql)
End Sub
Public Sub Execute2(ByVal strSql As String)
Rst2 = Cn.Execute(strSql)
End Sub
Public Sub Execute3(ByVal strSql As String)
Rst3 = Cn.Execute(strSql)
End Sub
Public Sub Close()
Cn.Close()
End Sub
End Class
Regards,
Siva Kumar
Siva
Continue reading...
I have custom application that unable to connect to database and giving error below. I am using SQl express with 2017 console. Let me know whether you need any more information to help me resolve this issues. Thanks.
Here is the code
Imports ADODB
Imports System.Data.OleDb
Imports System.IO
Imports System.Data
Public Class DatabaseCn
Public strDBDir As String
Public Cn As Connection
Public cmdSP As Command
Public Rst As Recordset
Public Rst1 As Recordset
Public Rst2 As Recordset
Public Rst3 As Recordset
Public da As OleDbDataAdapter
Public ds As DataSet
Public dt As DataTable
Public CnMode As Integer = ConnectModeEnum.adModeUnknown
Public cmdType As Integer = CommandTypeEnum.adCmdStoredProc
Public CnStr As String
Public Sql As String
Public Sub New()
Cn = New Connection
cmdSP = New Command
Rst = New Recordset
Rst1 = New Recordset
Rst2 = New Recordset
Rst3 = New Recordset
da = New OleDbDataAdapter
ds = New DataSet
dt = New DataTable
'***SQL***
'Cn.CursorLocation = CursorLocationEnum.adUseServer
Cn.CursorLocation = CursorLocationEnum.adUseClient
CnStr = "Provider=sqloledb; Data Source=" & objSQL.Server & "; Initial Catalog=" & objSQL.Database & "; " _
& "User ID=" & objSQL.UserID & "; Password=" & objSQL.UserPwd & ";"
End Sub
Public Sub Open()
Cn.Open(CnStr, objSQL.UserID, objSQL.UserPwd, CnMode)
End Sub
Public Sub Execute(ByVal strSql As String)
Rst = Cn.Execute(strSql)
End Sub
Public Sub Execute1(ByVal strSql As String)
Rst1 = Cn.Execute(strSql)
End Sub
Public Sub Execute2(ByVal strSql As String)
Rst2 = Cn.Execute(strSql)
End Sub
Public Sub Execute3(ByVal strSql As String)
Rst3 = Cn.Execute(strSql)
End Sub
Public Sub Close()
Cn.Close()
End Sub
End Class
Regards,
Siva Kumar
Siva
Continue reading...