ODBC database connection

I've not done any programming for years, last time was ASP and now I see there is this thing called ASP.NET !!!

bassically i can't find code anywhere to create an ODBC connection, can someone tell me how. I have however found the below code to connect to a file database, i have tried guessing what it might be, but just get errors. 

<script runat="server">
sub Page_Load
   dim dbconn
   dbconn=New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;
   data source=" & server.mappath("northwind.mdb"))
   end sub

12/24/2007 11:20:16 AM
asp.net.object-datasource 16182 articles. 0 followers. Follow

1 Replies

Similar Articles

[PageSpeed] 18

If you are using Access, then you need to avoid ODBC.  It has been deprecated, probably sometime since you last did any programming :-)

Your connection string looks like it should work - depending on the location of the database. However, I would use the App_Data folder for the database, which was added in ASP.NET 2.0, and disallows people browsing to and downloading any files inside it.  Then the connection string can make use of the "|DataDirectory|" token, which always finds the App_Data folder:

Dim connstring As String = "Provider=Microsoft.Jet.OleDb.4.0;Data Source=|DataDirectory|NorthWind.mdb"
Dim query As String = "Select * From Table"
Using conn As New OleDbConnection(connstring)
Using cmd As New OleDbCommand(query,conn)
End Using
End Using

This might be of help too: http://www.mikesdotnetting.com/Article.aspx?ArticleID=26


Regards Mike
My site
12/24/2007 12:14:58 PM

Similar Artilces:

ODBC error:[Sybase][ODBC Driver] Connection not open:not connected to SQL database
Aloha, Have you come across this error before? Is it a Sybase error or a Crystal Reports error? Any clues? Mahalo, Lydia Villanueva Management Information Systems Grand Wailea Resort, Hotel & Spa It looks like you are attempting to communicate over a connection that has not been established or has been severed. Have you got any additional information? -- Jim Egan [TeamPS] Dealer Solutions, Inc. Houston, TX See you at the Powersoft User Conference in August - http://www.sybase.com/events/psuc98 ...

Timeout connecting with .NET connection object
I have a SQL Anywhere 9 database that I can connect to fine via Sybase Central or ISQL. However, when I attempt to connect using the AsaConnection object from the IAnywhere.Data.AsaClient namespace, the open connection call times out. The code works fine on my development box, but I cannot get the connection to work on the production box. Any ideas? Thanks, David ...

Can't connect to MySQL database using ODBC.NET
I recently downloaded and installed ODBC.NET from Microsoft Download Center site. I can reference the namespace (Microsoft.Data.Odbc) in my project and the code (C#) compiles just fine. However, at runtime, I cannot connect to the database. It keeps complaining about not being able to find the data source. The connection string is: "Driver={MySQL};SERVER=...;DATABASE=...;UID=...;PASSWORD=...;PORT=3306;OPTION=3;STMT=;" If I use MySQL ODBC driver, I have no problem whatsoever. The connection string is almost the same, only Driver={MySQL} is replaced by Driver={MySQL ODBC 3.5...

OleDb.Net vs. ODBC.Net Connection to Oracle
I want to connect to an Oracle database, and I understand that I can use either the OleDB.Net data provider or the ODBC.Net data provider for my connection. Does it matter which one I use? What are the advantages and disadvantages of each? Would appreciate any input. ODBC is slower than OleDb. because ODBC has to talk to OleDbProvider then OleDbProvider will talk to Oracle Db. Instead if you are able to use OleDb straight to DB then it will be faster. If you only have THOSE choices, I would take OleDb over ODBC any day. If you are using Framework 1.1, you have the choice of using th...

ODBC Connection parameter for ASA database for FireDac Connectivity
Hi , we are migrating our Delphi application from BDE to FireDac and during the database connectivity in BDE we have used below ODBC connection code parameter: ====================================== Connection definition parameters for BDE ===================================== DATABASE NAME = Globalware.db ODBC DSN= Globalware32 OPEN MODE=READ/WRITE BATCH COUNT=200 MAX ROWS=-1 SCHEMA CACHE SIZE=8 SCHEMA CACHE TIME=-1 SQLPASSTHRU MODE=SHARED AUTOCOMMIT ENABLE SCHEMA CACHE=FALSE ENABLE BCD=FALSE ...

Database Connection???How to connect a Database in an other server?
How to connect a Database(.mdb) in an other server? Can I use the connection string like below? mycon.ConnectionString="Provider=Microsoft.Jet.OLEDB.4.0; Data Source=http://www.****.com/***/mydb.mdb" You can not. That simple. Access is file based. No a client/server architecture.Thomas TomiczekPowerNodes ApS(Microsoft MVP C#/.NET)---Building a Website? Try the PowerNodes CMS - http://www.powernodes.com/ Correction: you can. Just make sure you can reach the acces db file - through a file share that is bound as drive. Not that you should. Performance will be horrib...

Connect to Other ODBC Database
Hi Is it possible to connect to an ODBC database other than a Sybase one from within a stored procedure ? The goal here is to be able to copy data from one database (In this case a foxpro db into a Sybase database without the need to export and import data). If so, is there any documentation on this topic with connection syntaxes etc? Verison of Sybase 6.0.03 Thanks in Advance Hi, yes, its possible. Read the Chapter 28 of the ASA User's Manual - Accessing Remote Data. Cheers, Hartmut Branz Sybase Product Support Engineering Adaptive Server Anywhere T...

Access Database Connection/Query Problem: "Object reference not set to an instance of an object"
I have been working on a web site in Visual Web Developer for several months.  For no apparent reason, I can no longer create, modify, or connect to my Microsoft Access database source.  The database is still where it has always been, still opens, etc.  Below are a few of the symptoms.  Does anyone know what would cause this and more importantly how I can fix it? (1) I can no longer use the "Query Builder" with existing or new aspx pages; when I try I get this message: "Object reference not set to an instance of an object" (2) I tried using the "Design Custom Statement...

ODBC connect to Access database fails [Microsoft] [ODBC Driver Manager] Program Type out of Range
I was connecting and updating an Access97 Database OK. Office2000 was installed by our Help Desk and now I get the error SQLSTATE = S1003 [Microsoft] [ODBC Driver Manager] Program Type out of Range I tried creating an New ODBC entry with a newly created MSAccess database but got the same error. Any Help Appreciated I remember having this error also. What i did to solve it was the following -click the database painter -you get a list of all tables of your current db -press cancel button -change your connect in File/connect to the correct db. HTH John Which P...

[Sybase][ODBC Driver]Unable to connect to database server:unable to start database engine (#-80)
Hi ! I hope somebody could help me. Here is the problem in details : I have an SQL ANYWHERE 5.0 database on a server machine named "fr1dbsybase". I have an SQL CLIENT 5.0 on my machine. I configure an ODBC connection on my machine. I want to connect to the database with MS ACCESS via the ODBC connection. But I got the error message : [Sybase][ODBC Driver]Unable to connect to database server:unable to start database engine (#-80) -------- I tried something else. I uninstall the client on my machine and install the server. I start the sample database &qu...

can't connect to sql server database with same connection used in visual studio .net 2003
I have the following code that works fine in visual studio .net 2003 but not with VWD.  I have sql server 2000 developer edition installed locally and this connection works fine with visual studio.  With VWD it fails with the exception "System.Data.SqlClient.SqlException: Login failed for user 'DARRELL\ASPNET'".  It fails on the conn.Open line.   any ideas on what the issue is?Dim conn As SqlConnectionDim connstr As Stringconnstr = "Data Source=DARRELL;Initial Catalog=Event;Integrated Security=SSPI;"Dim daEvents As New SqlDataAdapter("select * from events", connstr...

SQLSTATE = 08001 [Sybase][ODBC Driver] Unable to connect to database server.unable to start database engine.
Hi, When running my PB application in PB it works fine, a splash screen and then the application. When running my application through Powerbuilder WDK the splash screen shows up and then a login box shows up which shouldn't. This box asks for a username and password and has the title "Connect to SQL Anywhere". I know it's a result of the SQLCA properties but I don't know how to fix the problem. Can any one help me out? The SQLCA code and ini file is below. PB code: startupfile = "pds.ini" /* Populate sqlca from current pds.ini settings */ sql...

"Transaction not connected" error trying to connect to an ODBC database via PB7 Com in MTS
Non-database com object in MTS works aok, but connecting to a MSSQL Server database fails with "Transaction not connected" error. Seems like a rudimentary issue. Any tutorials or white papers re PB7/MSSqlServer 6.5/MTS? Any help apprecicated. -bac More details... DTS IS running on SQL Server. "Robert A. Chauvin" wrote: > Non-database com object in MTS works aok, but connecting to a MSSQL > Server database fails with "Transaction not connected" error. > > Seems like a rudimentary issue. > > Any tutorials or white pap...

Silly question: How do I connect to an ACCESS database with out getting the "object reference not set to an instance of an object" message?
1. Created folder App_Data 2. Add mdb file 3. Drag AccessDataSource control to form. 4. Map to the mdb file. 5. Build query and get "object reference not set to an instance of an object" error. What am I missing? I had no trouble connecting to SQL Server 2005 on the server, but the local mdb file??? Thanks, Bill    at what code, or exactly where are you getting the error message?David WierMCP/ASPInsiderASPNet101.com - where to look first!Control Grouper - easily control properties for multiple controls with one control!Calendar Express - The Best HTML Calendar Generator ...

Web resources about - ODBC database connection - asp.net.object-datasource

Connection - Wikipedia, the free encyclopedia
Text is available under the Creative Commons Attribution-ShareAlike License ;additional terms may apply. By using this site, you agree to the ...

iMedia Connection: Interactive Marketing News, Features, Podcasts and Video - iMediaConnection.com
High-quality data, if not used properly, can still lead marketers to make bad decisions. Consider these common ways that numbers are used to ...

HTTP persistent connection - Wikipedia, the free encyclopedia
... tacked on to an existing protocol. If the browser supports keep-alive, it adds an additional header to the request: Following this, the connection ...

CareerSonar Turns Facebook Friends Into Job Connections
Looking for a job ? Among your Facebook friends lies the potential for employment. CareerSonar , a new service, brings together a person’s connections ...

Complex Regional Pain Syndrome: CPRS researchers study auditory connection
For 16 years Kerry Whyman ``secretly&quot; thought she had bone cancer and was dying secretly because she'd stopped telling doctors how much ...

Fictional Lawyers Use Their Family Connections Too
This film character had a family connection to his lawyer.

This Is How Facebook Is Working to Improve Experience On Slower Connections
... the globe, that’s not their situation . In recent years, Facebook has paid close attention to its user experience on 2G and other slow connections. ...

Addappt now lets you block contacts and connections
... gives you even more control than before. New features Block a current contact from connecting if they use Addappt down the road Block a connection ...

Facebook becomes more adept at dealing with crappy connections
... to get a decent phone signal to allow you to post a photo of your meal. Joking aside, in countries where people are struggling with 2G connections ...

Internet connections at UK universities have been knocked out by a 'persistent' cyber attack
... internet following a targeted cyber attack on a nationwide education network. The University of Manchester said on Tuesday its internet connection ...

Resources last updated: 12/13/2015 9:04:19 AM