.NETGURU
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




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification