Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Code-behind oleDB connection (asp newbie)

Status
Not open for further replies.

gtrscott

IS-IT--Management
Dec 31, 2003
21
US
Hi All,

I'm trying to get a code-behind oledbconnection working. There are plenty of same page examples but I can't seem to get things initialized properly in a code-behind page. Is there a declaration similar to the namespace=system.data.oledb for code-behind or am I going about this all wrong?

Thanks!
 
At the top of the code-behind you need to put:
Imports System.Data.OleDB

Then you can:

Dim myConn as OleDBConnection
myConn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\YourDB")
myConn.Open()

The key is that "Imports" statement at the top. Other than that it will be just like the one-page examples.
 
Thanks very much!!! That did the trick!

Scott
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top