Newbie needs help writing to database

Results 1 to 2 of 2

Thread: Newbie needs help writing to database

  1. #1
    Join Date
    Dec 1969

    Default Newbie needs help writing to database

    All I am trying to do is take the responses from a form and push them into an Access database. Nothing fancy at all. I am not getting any errors when the script is run, but the data is not being written to the database. I&#039;m sure there is one small thing I&#039;m missing. Would appreciate any help with this. Thanks.<BR><BR>&#060;!-- METADATA TYPE="typelib" FILE="C:Program FilesCommon FilesSystemadomsado15.dll" --&#062;<BR><BR>&#060;%<BR> Option Explicit<BR> Dim objConn,objRS<BR> &#039;Set and open connection<BR> Set objConn = Server.CreateObject("ADODB.Connection")<BR> objConn.Open "Provider=Microsoft.Jet.OLEDB.4.0; " & _<BR> "Data Source= c:ArcIMSwebsitekingsport2visitors.mdb"<BR> <BR> &#039;Set and open recordset<BR> Set objRS = Server.CreateObject("ADODB.Recordset")<BR> objRS.Open "ziptable", objConn, adOpenDynamic, adLockPessimistic, adCmdTable<BR> objRS.MoveLast<BR> &#039;add a new record at the end of the list <BR> objRS.AddNew <BR>&#039;write new info to recordset<BR><BR> objRS.Fields("FName") = Request.Form("FName") objRS.Fields("LName") = Request.Form("LName")<BR> objRS.Fields("Email") = Request.Form("Email")<BR> objRS.Fields("ZIP") = Request.Form("ZIP")<BR> objRS.Fields("Country") = Request.Form("Country")<BR> objRS.Fields("VisitDateTime") = Now<BR> objRS.Update<BR> <BR> objRS.Close<BR> Set objRS = Nothing<BR> objConn.Close<BR> Set objConn = Nothing<BR> <BR> <BR> %&#062;

  2. #2
    Join Date
    Dec 1969

    Default RE: Newbie needs help writing to database

    Why not try using Sql to do the insert ?<BR><BR>Sql = "Insert Into ziptable (FName, LName, Email, ZIP, Country, VisitDateTime) Values (&#039;" & Request.Form("FName") & "&#039;, &#039;" & Request.Form("LName") & "&#039;, &#039;" & Request.Form("Email") & "&#039;, &#039;" & Request.Form("ZIP") & "&#039;, &#039;" & Request.Form("Country") & "&#039;, #" & Now() & "#)"<BR><BR>objConn.Execute Sql<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts