conn.open asp.net

A

amitbadgi

Hi I am converting an asp application to asp.net, and I have an access
database, now when I am running the converted asp.net application in a
browser, I am getting the following error, I am new in this field,
hence need help, thanx in advance

[Microsoft][ODBC Driver Manager] Data source name not found and no
default driver specified
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.

Exception Details: System.Runtime.InteropServices.COMException:
[Microsoft][ODBC Driver Manager] Data source name not found and no
default driver specified

Source Error:

Line 10: db_p = db_UP.GetPASS_CC_1()
Line 11: db_dsn = db_UP.getDSN_CC_1()
Line 12: conn.Open (db_dsn, db_u, db_p)
Line 13: 'response.Write(db_dsn&" "& db_u&" "& db_p & "<br>")
Line 14:
 
G

Guest

It looks like you aren't using the command object's properties to get into
the database.

Did you set the properties of your connection object the "ado.net" way?
ie:

Public Sub CreateMyOleDbCommand()
Dim mySelectQuery As String = _
"SELECT * FROM Categories ORDER BY CategoryID"
Dim myCommand As New OleDbCommand(mySelectQuery)
myCommand.Connection = New OleDbConnection _
("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=NWIND_RW.MDB")
myCommand.CommandTimeout = 20
End Sub

By the way, that example code (from the sdk) is a crappy example since it
has a hardcoded connection string. An advantage of ASP.net is that you can
store connection strings in the web.config file (one central place) and then
retreive them by doing this: AppSettings("ConnString")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top