programming change
webdesign | Posted 6:23am 14. October 2007 Server Time |
My hosting company changed the way they handle asp.
A tier 2 technician was kind of enough to send me a sample script.
I am used to doing it this way....
<%
Dim Conn,rs,sSql
Set conn = server.createobject("ADODB.connection")
Conn.provider="Microsoft.Jet.OLEDB.4.0"
Conn.Open(Server.Mappath("database.mdb"))
set rs = Server.CreateObject("adodb.RecordSet")
sSQL = "Select * from yourdatabase"
rs.Open sSql, Conn, 3
%>
and here is what he sent me.....
Dear Customer,
Thank you for contacting Tech Support
Per one of our knowlegebase articles (I appologize, it seems to be down atm, in preparation for our vdeck 3.0 migration) the below is the current method of accessing access databases.
You can use the code found below this line to connect to an Access Database through ASP. Please note: StartLogic Technical Support does not provide assistance with web scripting. The code below is provided out of courtesy.
<%
Dim DBPath,objRS,objConn
'----------------------------------------------------
'DO NOT MODIFY ABOVE THIS LINE
'----------------------------------------------------
' Change the path below to the actual location of your mdb file
DBPath="/db/file.mdb"
'----------------------------------------------------
'DO NOT MODIFY BELOW THIS LINE
'----------------------------------------------------
Set objConn=Server.CreateObject("ADODB.Connection")
objConn.ConnectionString="Driver={Microsoft Access Driver
(*.mdb)};DBQ=" & Server.mappath(DBPath)
objConn.Open
Set objRS=Server.CreateObject("ADODB.Recordset")
%>
Please feel free to contact us further if needed.
having problems with the above code....anything missing?
I am getting lots of errors
Thanks |
webdesign | Posted 6:33am 14. October 2007 Server Time |
I have other websites that run on other servers by the same hosting company.
The hosting company is telling me that they will migrate all servers to update to newer software.
Not good for me.
katy8439 | Posted 3:32am 15. October 2007 Server Time |
What sort of errors are you getting - do you have an example?
webdesign | Posted 7:56pm 15. October 2007 Server Time |
I am getting this error
Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[Microsoft][ODBC Microsoft Access Driver]General error Unable to open registry key 'Temporary (volatile) Jet DSN for process 0x6228 Thread 0x88f0 DBC 0x16f2024 Jet'.
Here is some of the code I am using....I am opening 2 databases on the same page.
-------------------------------
<%
Set Conn = Server.CreateObject("ADODB.Connection")
MdbFilePath = Server.MapPath("database.mdb")
Conn.Open "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & MdbFilePath
SQL_query = "Select * from databasetable"
%>
<%
Set Conn2 = server.createobject("ADODB.connection")
MdbFilePath2 = Server.MapPath("database2.mdb")
Conn2.Open "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & MdbFilePath2
SQL_query2 = "SELECT * FROM databasetable2"
%>
Fredde | Posted 9:50am 16. October 2007 Server Time |
checkout http://p2p.wrox.com/archive/asp_database_setup/2001-02/39.asp.
Tawni | Posted 8:33pm 8. November 2007 Server Time |
Don't Panic this is no Big Deal, I went though it as well.
I actually Prefer the new way.
Air code follows:
dim dbDir,sql
set DbConn = Server.CreateObject("ADODB.Connection")
dbDir = Server.MapPath("./access_database/Your.mdb")
DbConn.Open "DBQ="& dbDir & ";Driver={Microsoft Access Driver (*.mdb)}"
sql= "select * From Table_Name"
note: "./access_database" <----is the secure folder you host prefers you to put your database.
then the name of the database follows this
"Your.mdb"
Tawni | Posted 8:37pm 8. November 2007 Server Time |
Note : Server.Mappath was the old days where the server would locate where you put your database.
Now with security coming into the picture I think is why
Hosts force you to use a Certain Folder.
you should never in my OP put your database where it can be downloaded.
thats why they give you a secure path
/access_db/database_name.mdb
Ask your Host what folder your suppose to put your database in .
mine is /access_db
Reply to Post programming change
|
|
|