Odbc - what now?

Striver

Member
Joined
Feb 7, 2006
Messages
5
Programming Experience
3-5
Hi. Untill recently, i knew absolutly nothing about ODBC in CB.NET. I have googled up how to gain access to the "ODBC database Administrator", and added a DSN entry of the file i had in mind (named "test.mdb").

I created the file using something i found on the net:

VB.NET:
Dim cat As New Catalog()

cat.Create("Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\NewDB.mdb")

But now what?

I have installed the ODBC add ons, and know about writing "Imports Microsoft.Data.Odbc", but i don't get the rest.


I have fond this on the net:


VB.NET:
        Dim strConnectionString As String = "DRIVER={SQL Server};SERVER=localhost;UID=sa;DATABASE=pubs;"
        Dim pConn As New OdbcConnection(strConnectionString)
        Dim pInsertQuery As String = "SELECT * FROM Titles"
        Dim adapter As New OdbcDataAdapter(pInsertQuery, pConn)
        Dim titleDS As DataSet = New DataSet()

        Try
            adapter.Fill(titleDS, "Titles")
            DataGrid1.SetDataBinding(titleDS, "Titles")
            DataGrid1.Show()
        Catch ex As OdbcException
            MsgBox(ex.Message)
        Finally
            pConn.Close()
        End Try
And i don't know if that is supposed to work or not... what i know is that i should edit the "DRIVER={SQLServer};SERVER=localhost;UID=sa;DATABASE=pubs;" part in some way, but i don't know what to edit it to, and most importantly, why?

Since test.mdb is not a Sql file, rather an Access file, i would guess that the "DRIVER={SQLServer}" is flawed, but i don't know what to change it to... or maybe that is irrelevant... since that is regarding the connection _to_ the odbc and not regarding how the odbc connects to test.mdb...

further, what is "SERVER=localhost;UID=sa;DATABASE=pubs" about? I know nothing about servers, UIDs (whadever that is) and so on... :(


Help me out please, thanks in advance!
 
Last edited by a moderator:
Back
Top