N
No_So_Clever
Hi I have the following for My Database connection in my project:
Con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=J:\Database\MasterDB.mdb"
UP.Connection = Con
UP.CommandType = CommandType.Text
UP.CommandText = "Select * From Passwords Where Users_Name=? and
Users_Password=?"
I`ve now want to use a connection class of (Allowing me use choose a
Database to Use):
Private Shared mConnectionsstring As String =
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
Private Shared mLocation As String
Private Shared connArray As ArrayList
Public Shared Sub setString(ByVal ind As Integer)
Dim connArray As New ArrayList
connArray.Add("D:\Database\MasterDB.mdb")
connArray.Add("D:\Database\LocalDB.mdb")
'Use For Debugging DB Connection Errors
'MessageBox.Show(ind.ToString())
mLocation = connArray(ind).ToString
End Sub
Public Shared ReadOnly Property [String]() As String
Get
Return "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & mLocation & ";"
End Get
End Property
I know I need to change my "Con.ConnectionString =
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=J:\Database\MasterDB.mdb" I
thought it would be changed to:
Con.ConnectionString = Me.cboSelectDB.SelectedIndex but then it tells me
"Option Strict On disallows implicit conversions from 'Integer' to 'String'"
if I take Options Strict On off it errors and says: "Format of the
initialization string does not conform to specification starting at index
0."
Could somebody kindly point me in the right Direction for a fix?
Many Thanks
NSC
Con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=J:\Database\MasterDB.mdb"
UP.Connection = Con
UP.CommandType = CommandType.Text
UP.CommandText = "Select * From Passwords Where Users_Name=? and
Users_Password=?"
I`ve now want to use a connection class of (Allowing me use choose a
Database to Use):
Private Shared mConnectionsstring As String =
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
Private Shared mLocation As String
Private Shared connArray As ArrayList
Public Shared Sub setString(ByVal ind As Integer)
Dim connArray As New ArrayList
connArray.Add("D:\Database\MasterDB.mdb")
connArray.Add("D:\Database\LocalDB.mdb")
'Use For Debugging DB Connection Errors
'MessageBox.Show(ind.ToString())
mLocation = connArray(ind).ToString
End Sub
Public Shared ReadOnly Property [String]() As String
Get
Return "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & mLocation & ";"
End Get
End Property
I know I need to change my "Con.ConnectionString =
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=J:\Database\MasterDB.mdb" I
thought it would be changed to:
Con.ConnectionString = Me.cboSelectDB.SelectedIndex but then it tells me
"Option Strict On disallows implicit conversions from 'Integer' to 'String'"
if I take Options Strict On off it errors and says: "Format of the
initialization string does not conform to specification starting at index
0."
Could somebody kindly point me in the right Direction for a fix?
Many Thanks
NSC