Do I still need this connection string?

Do I still need this for the connection string .... one of the reasons I had it in a method was so that I could change the address of the database...

' ************************************************************
This is a connection string, though I'am sure I should not need the whole thing can you inlighten me what I would need for the code below this code for it to allow me to change the address for the connection string .mdb
' ************************************************************

'
'OleDb_Conn
'
Me.OleDb_Conn.ConnectionString = "Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Registry Path=;Jet OLEDB:Database L" & _
"ocking Mode=1;Data Source=""C:\Major\Customers.mdb"";Jet OLEDB:Engine Type=5;Provi" & _
"der=""Microsoft.Jet.OLEDB.4.0"";Jet OLEDB:System database=;Jet OLEDB:SFP=False;per" & _
"sist security info=False;Extended Properties=;Mode=Share Deny None;Jet OLEDB:Enc" & _
"rypt Database=False;Jet OLEDB:Create System Database=False;Jet OLEDB:Don't Copy " & _
"Locale on Compact=False;Jet OLEDB:Compact Without Replica Repair=False;User ID=A" & _
"dmin;Jet OLEDB:Global Bulk Transactions=1"

' ************************************************************
This is what I have so far, though it does not fill the databinding. nor allows me to add a address for the database.mdb
' ************************************************************
Private
Function setConn(ByRef conn_String As String) As String
MessageBox.Show("setString::: " & vbCrLf & "<>" & Environment.NewLine & conn_String, "Setting") ' Testing Value
Dim OleDB_DA As New System.Data.OleDb.OleDbDataAdapter("Select * from tblcustomers", OleDb_Conn)
OleDb_Conn.Open()
OleDB_DA.Fill(ds_Customers)
OleDb_Conn.Close()
ds_Customers.Clear()
OleDb_DA.Fill(ds_Customers)
End Function




Answer this question

Do I still need this connection string?

  • Ripon12

    This is my sollution to the connection string,

    Private
    Function setConn(ByRef conn_String As String) As String
    Dim OleDB_DA As New System.Data.OleDb.OleDbDataAdapter("Select * from tblcustomers", "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & conn_String & ";User Id=admin;Password=;")
    End Function

    Private Sub mnu_Open_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnu_Open.Click
    OFD_Database.ShowDialog()
    setConn(OFD_Database.FileName())
    ds_Customers.Clear()
    OleDb_DA.Fill(ds_Customers)
    MessageBox.Show("Database Open" & vbCrLf & "<>" & Environment.NewLine & "", "Confirm")
    End Sub

    Thanks
    Binary



  • Do I still need this connection string?