Missing Reference to Microsoft.Data.ODBC.dll
Messages   Related Types
This message was discovered on ASPFriends.com 'aspngvb' list.


Velayutham, Muthuraj
I am trying to connect to my DB using the following code. Which gives me the
error on compile

C:\DotNET\vbnet\testdbconnection\testdbconnection\Form1.vb(1): Namespace or
type 'ODBC' for the Imports 'Microsoft.Data.ODBC' cannot be found.

I know I need to add the reference to "Microsoft.Data.ODBC.dll" to use
Import "Microsoft.Data.ODBC". I don't see "Microsoft.Data.ODBC.dll" on my
Project references. I have installed MDAC 2.7 on my system. But still I
couldn't see "Microsoft.Data.ODBC.dll" on my Project Reference .NET tab.

Any pointer will be greatly appreciated.

Imports Microsoft.Data.ODBC
Public Class Form1
Inherits System.Windows.Forms.Form

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim cn As OdbcConnection

Try
cn = New OdbcConnection("Driver={SQL
Server};Server=(local);Database=dbname;Trusted_Connection=Yes")

Dim cmd As OdbcCommand = New OdbcCommand("select * from
employee", cn)

cn.Open()

Dim dr As OdbcDataReader = cmd.ExecuteReader()

While dr.Read
Console.WriteLine(dr.GetString(0))
End While
dr.Close()

Catch o As OdbcException

MsgBox(o.Message.ToString)

Finally

cn.Close()

End Try
End Sub
End Class
Reply to this message...
 
    
Daniel Naumann
Missing Reference to Microsoft.Data.ODBC.dllThe ODBC manage provider isn't in
MDAC, it's an extra add in you can download from:
http://msdn.microsoft.com/downloads/default.asp?url=/code/sample.asp?url=/msdn-f
iles/027/001/668/msdncompositedoc.xml&frame=true

Daniel.
-----Original Message-----
From: Velayutham, Muthuraj [mailto:Click here to reveal e-mail address]
Sent: 24-Jul-2002 11:02
To: aspngvb
Subject: [aspngvb] Missing Reference to Microsoft.Data.ODBC.dll

I am trying to connect to my DB using the following code. Which gives me the
error on compile

C:\DotNET\vbnet\testdbconnection\testdbconnection\Form1.vb(1): Namespace or
type 'ODBC' for the Imports 'Microsoft.Data.ODBC' cannot be found.

I know I need to add the reference to "Microsoft.Data.ODBC.dll" to use Import
"Microsoft.Data.ODBC". I don't see "Microsoft.Data.ODBC.dll" on my Project
references. I have installed MDAC 2.7 on my system. But still I couldn't see
"Microsoft.Data.ODBC.dll" on my Project Reference .NET tab.

Any pointer will be greatly appreciated.

Imports Microsoft.Data.ODBC
Public Class Form1
Inherits System.Windows.Forms.Form

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim cn As OdbcConnection

Try
cn = New OdbcConnection("Driver={SQL
Server};Server=(local);Database=dbname;Trusted_Connection=Yes")

Dim cmd As OdbcCommand = New OdbcCommand("select * from employee",
cn)

cn.Open()

Dim dr As OdbcDataReader = cmd.ExecuteReader()

While dr.Read
Console.WriteLine(dr.GetString(0))
End While
dr.Close()

Catch o As OdbcException

MsgBox(o.Message.ToString)

Finally

cn.Close()

End Try
End Sub
End Class

| [aspngvb] member Click here to reveal e-mail address = YOUR ID |
http://www.asplists.com/asplists/aspngvb.asp = JOIN/QUIT
Reply to this message...
 
 
System.Console
System.Data.Odbc.OdbcCommand
System.Data.Odbc.OdbcConnection
System.Data.Odbc.OdbcDataReader
System.Data.Odbc.OdbcException
System.EventArgs
System.Object
System.Windows.Forms.Form




Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
 
 Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us - Terms of Use - Privacy Policy - www.dotnet247.com