|
-
Dec 17th, 2002, 06:16 PM
#1
Thread Starter
Member
ADO connection in VB.NET
Hi,
I have referenced ADO2.7 .
When i try to write import namespaces ,I could not find ADO.
ie
Import System.Data
Imports System.Data.ADO(this ADO i could not find)
I cannot declare object variable for ADODB.connection.
if i try to write
Dim conn as adodb.connection
I am getting error is
statement is not valid in a namespace
How can i install and use MDAC2.o in my COM(Add reference)
Please help me out.
Thanks.
-
Dec 17th, 2002, 07:56 PM
#2
PowerPoster
Don't use COM for data access anymore, not if you are doing .Net apps anyway.
Here is a link to get you started:
http://samples.gotdotnet.com/quickst...odtreader.aspx
-
Dec 18th, 2002, 02:07 AM
#3
Registered User
I agree with hellswraith, but if you really want to use ADO2.7, the only thing you have to do is to add a reference to it in your application and you should be able to reference the namespace. I had a ADODB namespace anyway.
-
Dec 18th, 2002, 11:14 AM
#4
Thread Starter
Member
Thanks .it works well but i have new problem
Hi,
Thanks .It works well now but facing new problem.
When i try to run the program it could not find the database application path and gives an error
the error is:
'System.runtime.interopservices.comException'occured in MArana form.exe
additional inforamtion for error is:
pl check the path name and spelled correctly.
the code:
Imports System.IO
Imports System.Reflection
Imports System.Windows.Forms.Application
Imports System.Runtime.InteropServices.COMException
Public Class Form1
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim mAppPath As String
mAppPath = System.Reflection.Assembly.GetExecutingAssembly.Location
Dim Conn As ADODB.Connection
Dim objword As Word.Application
Conn = New ADODB.Connection()
Conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & mAppPath & "\testdb.mdb;Mode=Share Deny None"
Conn.Open()
thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|