Hello! I have a problem regarding Odbc driver. So, here's the thing: i'm using .net framework v1.1 and have a .mdb database that i would like to connect to. When i use oledb provider works fine, but when i would like to use dsn and odbc driver i just can't
figure it out. The code: <script runat="server"> Sub Page_Load() ' Code that populates datagrid Dim strConnection as String Dim strSQL as String Dim objConnection as OdbcConnection Dim objDataSet as New DataSet Dim objDataAdapter as OdbcDataAdapter strConnection
= "Provider=Microsoft.Jet.Odbc;Data Source=c:\program files\common files\odbc\data sources\test.dsn" strSQL = "SELECT FirstName, LastName FROM Employees" objConnection = New OdbcConnection(strConnection) objDataAdapter = New OdbcDataAdapter(strSQL, objConnection)
objDataAdapter.Fill(objDataSet, "Employ") dgNameList1.DataSource = objDataSet.Tables("Employ") dgNameList1.DataBind() .. ... So here i've made a dsn that points to .mdb and from here i would like to connect. I guess the problem is with "Provider" section...but
i'm a newbie with .net so i'll appreciate any help or hint with this. Thanks!
........prova=odbc datasource ........stringa=select string try this Dim ocon As New ADODB.Connection() : ocon.Open(dsn=Prova;uid=;pwd=;) Dim Rs2 As New ADODB.Recordset() : Rs2 = ocon.Execute(stringa) Dim ds2 As New DataSet("recordset") : ds2.Tables.Clear()
Dim DA2 As New OleDb.OleDbDataAdapter() : DA2.Fill(ds2, Rs2, "tabella") If ds2.Tables("tabella").Rows.Count <> 0 Then end if
Lookie
Member
15 Points
3 Posts
Unable to establish connection through Odbc driver
Oct 20, 2003 02:34 PM|LINK
martin.laroc...
Member
80 Points
16 Posts
Re: Unable to establish connection through Odbc driver
Oct 20, 2003 03:20 PM|LINK