N
No_So_Clever
Hi,
Wonder if Somebody could help me? I`ve been searching all over for a
solution but am totally lost.
I have a Class called Connection as below:
Public Class Connection
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("J:\Database\MasterDB.mdb")
connArray.Add("J:\Database\TestDB.mdb")
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
End Class
On my Main Form I have my Database Connection Setup as:
Dim UP As New OleDb.OleDbCommand()
Dim Con As New OleDb.OleDbConnection()
Connection.setString(Me.cboSelectDB.SelectedIndex)
Con.ConnectionString = Connection.String
UP.Connection = Con
UP.CommandType = CommandType.Text
UP.CommandText = "Select * From Passwords Where Users_Name=? and
Users_Password=?"
End Sub
But when I run my App it Errors on line "mLocation =
connArray(ind).ToString" with the following error: "Additional information:
Index was out of range. Must be non-negative and less than the size of the
collection"
Anybody point me in the right direction?
Many Thanks in Advance
Regards
Not_So_Clever
Wonder if Somebody could help me? I`ve been searching all over for a
solution but am totally lost.
I have a Class called Connection as below:
Public Class Connection
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("J:\Database\MasterDB.mdb")
connArray.Add("J:\Database\TestDB.mdb")
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
End Class
On my Main Form I have my Database Connection Setup as:
Dim UP As New OleDb.OleDbCommand()
Dim Con As New OleDb.OleDbConnection()
Connection.setString(Me.cboSelectDB.SelectedIndex)
Con.ConnectionString = Connection.String
UP.Connection = Con
UP.CommandType = CommandType.Text
UP.CommandText = "Select * From Passwords Where Users_Name=? and
Users_Password=?"
End Sub
But when I run my App it Errors on line "mLocation =
connArray(ind).ToString" with the following error: "Additional information:
Index was out of range. Must be non-negative and less than the size of the
collection"
Anybody point me in the right direction?
Many Thanks in Advance
Regards
Not_So_Clever