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!

Need Help with Web Database Connections

Status
Not open for further replies.

bowfonz

IS-IT--Management
Jul 13, 2004
52
US
I need some help with database connections.

Here's the situation. I made some aspx pages that that use an OleDb Connection to call up an Access database and create DataSets, DataTables, etc. This works great on my WinXP machine.

I just uploaded my pages and database to my hosted server and it doesn't work, just hangs there without error. Tech support says they don't support DSN-less connections, they made a DSN on the server for me and told me to use ADODB.Connection to connect to it.

Now, I'm pretty new to ASP and Web Databases, but isn't ADODB.Connection for ADO/ASP and not ADO.NET/ASP.NET? ADO uses Recordsets, not Datasets so I'd have to completely rewrite everything.

Is there any way to connect to this database using the DSN or otherwise so that I don't have to rewrite everything? Is my host wrong for not supporting the OleDb Connection or is that pretty normal?

Thanks
-Tom
 
recordsets are for asp not .net, its possible you host does not support .net, but creating dsn-less connection in asp isn't hard we can walk you through provide something html code , or possibly what you want to achieve
 
They do support .NET. That's what's so vexing about this. I have other aspx pages that don't call databases and they all work just fine.

I'm not sure what you're saying though, steven920. I currently have an OleDb Connection which is DSN-less and it does not work. So what I really need is some other way to connect to the database, but preferably where I only need to change the connection, not the rest of my code with datasets and datatables.

If I use ADODB.Connection, it means a complete redo on all the pages because it's ASP not ASPX, recordsets instead of datasets. But what about ODBCConnection or some other way that is .NET friendly?

In short, my question is:
Is there a .NET, DSN connection to an Access database?

If my host supports .NET but only supports DSN connections to databases, then mustn't there be a .NET way to connect to a database by DSN? If not, then my host is hippocritical by saying "we support .NET, but not for databases", and they are behind the times and I need to start looking for yet another web host.

Thanks for any input.
-Tom
 
this not a .net forum, but here is a odbc dsn-less connection
Code:
Imports System.Data.Odbc
...
Dim oODBCConnection As OdbcConnection
Dim sConnString As String = _
         "Driver={Microsoft Access Driver (*.mdb)};" & _
         "Dbq=c:\somepath\mydb.mdb;" & _
         "Uid=Admin;" & _
         "Pwd="
oODBCConnection = New Odbc.OdbcConnection(sConnString)
oODBCConnection.Open()

here is a oledb
Code:
Imports System.Data.OleDb
...
Dim oOleDbConnection As OleDbConnection
Dim sConnString As String = _
         "Provider=Microsoft.Jet.OLEDB.4.0;" & _
         "Data Source=C:\myPath\myJet.mdb;" & _
         "User ID=Admin;" & _
         "Password=" 
oOleDbConnection = New OleDb.OleDbConnection(sConnString)
oOleDbConnection.Open()

try one of these, they have to support dsn-less
 
for dsn change the connectionstring part = "DSN=yourdsnnamehere;
 
for the dsn-less you prob dont know the full url to the db so use

odbc
"Dbq="& Server.MapPath("mydb.mdb") & ";" & _

oledb
"Data Source=" & Server.MapPath("mydb.mdb") & ";" & _
 
Strangely enough, I have an email from Tech Support this morning saying that it should work. They looked at the code to one of the aspx pages that I hadn't changed yet and said "you had the data source pointing to c: instead of d:". So they changed it to d: and renamed the file and it works.

But what I don't understand is that was the first thing I did last night. I changed the datasource path on one of the files to that of the servers and it simply did not work last night. I tried absolute path, server.mappath, you name it, nothing worked last night. But this morning it works fine.

Is there some sort of propagation thing going on or did they find a problem, fix it and then try to blame me by saying it was a bad path.

Anyway, thanks for all the responses. But it looks like I get to stick with OleDb and my pages don't need rewriting after all.

-Tom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top