Web Hosting Forum | Lunarpages


*
Welcome, Guest. Please login or register.
Did you miss your activation email?



Login with username, password and session length
May 16, 2012, 05:25:39 PM

Pages: [1]   Go Down
  Print  
Author Topic: Connecting to my Access DB using ASP  (Read 679 times)
ASSORRO
Newbie
*
Offline Offline

Posts: 1


« on: September 20, 2008, 03:35:28 PM »

Could someone please show me what is wrong with my connection string? I am new to plesk and don't know how to write a proper string for my msaccess database. I successfully created a new ODBC DSN, named it and tested it...okay. I set the permissions to read and write but I still can't write to the database. I'd appreciate some help here. Thanks.
Code:
<%
Dim recordset, connection
Dim sSQL, sConnString
sSQL="SELECT * from ARTICLES Where AUTONUMBER = 1"
Set Connection=Server.CreateObject("ADODB.Connection")
Set Recordset=Server.CreateObject("ADODB.Recordset"
sConnString="PROVIDER=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & Server.MapPath("news.mdb")
Connection.Open(sConnString)
Recordset.Open sSQL,connection,3,3
Set c = Server.CreateObject("ADODB.Connection")
set r = Server.CreateObject("ADODB.Recordset")
c.Provider="Microsoft.Jet.OLEDB.4.0"
c.Open Server.MapPath("news.mdb")
r.activeconnection=c
r.open  "Select * from ARTICLES Where AUTONUMBER = 1"
dim A1,B1,C1,D1,E1
A1=request.form("date")
        A1 = Replace(Request.form("date"), "'", "''")
B1=request.Form("title")
        B1 = Replace(Request.form("title"), "'", "''")
C1=request.Form("highlight")   
        C1 = Replace(Request.form("highlight"), "'", "''")
D1=request.Form("article")
        D1 = Replace(Request.form("article"), "'", "''")
E1=request.Form("author")
        E1 = Replace(Request.form("author"), "'", "''")
if not r.eof then
c.execute "Update ARTICLES set DT ='"& A1 &"' , TITLE='"& B1 &"' , HIGHLIGHT='"& C1 &"' , ARTICLE='"& D1 &"' , AUTHOR='"& E1 &"' Where AUTONUMBER = 1"
response.write "<font size='+4'>* ARTICLE ONE HAS BEEN UPDATED *</FONT>"
end if
r.close
set r=nothing
c.close
set c=nothing
%>
« Last Edit: October 28, 2008, 07:02:19 PM by ASSORRO » Logged
Pages: [1]   Go Up
  Print  
 
Jump to: