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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Newbie Database Connection Question

Status
Not open for further replies.

emblewembl

Programmer
May 16, 2002
171
GB
Hi All, I have been working with Classic ASP for some time and am totally familiar with working with SQL databases etc,. But I am having trouble getting the basic info for connecting to an SQL database using ASP.Net. I have notcied some examples seem to have this at the top (or something similar) :
Code:
<%@ Import Namespace=&quot;System.Data.OleDb&quot; %>
Can someone explain to me what this is?!! Also, just to get started I am trying to build a page which connects to my SQL database so that I can write some of the information to the screen. Can anyone give me an example?
Thanks!! i love chocolate
 
I love chocolate too.

The import statement you mentioned is just saying that the class for your page should import the System.Data.OLEDB group of classes, which means you can use them.

However, if you're using SQL server, you probably don't want the OLEDB stuff. You'll want the System.Data.SqlClient namespace of classes to connect.

D'Arcy
 
Thanks JFrost10, not including the correct namespace file was the problem, and I have just connected without problems! i love chocolate
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top