NewComer2009
10-31-2009, 06:39 PM
I would like to use ASP script to connect and open my local MS Access database, I also have the MS Access database at my c:\inetpub\wwwroot\Name_ID.mdb with have only 1 table List with 2 columns: column "Name"(defined as Text) & column "ID" (defined as Number)
I have my web-page ConnectLocalDatabase.asp at my web-site with the following codes:
<%
Dim strQuery, rsRequest, conn
set conn = CreateObject("ADODB.Connection")
conn.open "Provider=MS Remote;" &_
"Remote Server=http://27.33.22.211;" &_
"Remote Provider=Microsoft.Jet.OLEDB.4.0;" &_
"Data Source=c:\inetpub\wwwroot\Name_ID.mdb;"
set rsRequest = Server.CreateObject("ADODB.Recordset")
strQuery = "SELECT * From List Where ID= 1"
'=================================================
rsRequest.Open strQuery, conn, adOpenDynamic, adLockOptimistic, CmdTex
If Not rsRequest.EOF Then
Response.write(rsRequest("Name"))
Response.write("OK1")
End If rsRequest.Close
'=================================================
conn.Close
Response.write("OK2")
%>
If I comment-out codes between '=== ... '=== then my web-page show OK2 without any error, but when I remove those comment-out I will have web-page error
- If I connect directly with the same Name_ID.mdb on my web-site, then there is no error (sure I have to modify the "Remote Server=http://27.33.22.211;"
Note1: I even use ODBC Data Source Administrator to register the Name_ID.mdb in c:\inetpub\wwwroot\ as recomended
Note2: I did use www.showmyip.com to have my Internet address of my PC: 27.33.22.211
Can anyone help on this?
Thanks in-advanced
I have my web-page ConnectLocalDatabase.asp at my web-site with the following codes:
<%
Dim strQuery, rsRequest, conn
set conn = CreateObject("ADODB.Connection")
conn.open "Provider=MS Remote;" &_
"Remote Server=http://27.33.22.211;" &_
"Remote Provider=Microsoft.Jet.OLEDB.4.0;" &_
"Data Source=c:\inetpub\wwwroot\Name_ID.mdb;"
set rsRequest = Server.CreateObject("ADODB.Recordset")
strQuery = "SELECT * From List Where ID= 1"
'=================================================
rsRequest.Open strQuery, conn, adOpenDynamic, adLockOptimistic, CmdTex
If Not rsRequest.EOF Then
Response.write(rsRequest("Name"))
Response.write("OK1")
End If rsRequest.Close
'=================================================
conn.Close
Response.write("OK2")
%>
If I comment-out codes between '=== ... '=== then my web-page show OK2 without any error, but when I remove those comment-out I will have web-page error
- If I connect directly with the same Name_ID.mdb on my web-site, then there is no error (sure I have to modify the "Remote Server=http://27.33.22.211;"
Note1: I even use ODBC Data Source Administrator to register the Name_ID.mdb in c:\inetpub\wwwroot\ as recomended
Note2: I did use www.showmyip.com to have my Internet address of my PC: 27.33.22.211
Can anyone help on this?
Thanks in-advanced