Add record to Access Database

Results 1 to 6 of 6

Thread: Add record to Access Database

  1. #1
    chris horner Guest

    Default Add record to Access Database

    I just can&#039t get a simple form to add a record to my access database. I am trying to us Recordset with no success.<BR>Can any one help??

  2. #2
    Join Date
    Dec 1969
    Posts
    168

    Default RE: Add record to Access Database

    Dim DB_CONN_STRING<BR>DB_CONN_STRING = "DBQ=" & Server.MapPath("database.mdb") & ";"<BR>DB_CONN_STRING = DB_CONN_STRING & "Driver={Microsoft Access Driver (*.mdb)};"<BR>DB_CONN_STRING = DB_CONN_STRING & "DriverId=25;FIL=MS Access;"<BR>Set cnn = Server.CreateObject("ADODB.Connection")<BR>cnn.Ope n DB_CONN_STRING<BR>SQLqry="INSERT INTO tbl1 (txtfld,numfld,datefld) VALUES (&#039" & txtfld &"&#039," & numfld & ",#" & datefld &"#);"<BR>cnn.Execute SQLqry<BR>cnn.close <BR><BR>Hope this helps... Cheers!

  3. #3
    Join Date
    Dec 1969
    Posts
    27

    Default RE: Add record to Access Database

    here is another example of inserting records into a database.<BR><BR>Set SqlConn=Server.CreateObject("ADODB.Connection")<BR >strSQL = "Insert into news ([newsNo],[Heading],[Content],[AddedBy],[DateAdded]) VALUES (&#039" & Request.Form("AddNo") & "&#039, &#039" & Request.Form("Heading") & "&#039, &#039" & Request.Form("Content") & "&#039, &#039" & Request.Form("txtAddedBy") & "&#039, &#039" & DateAdded & "&#039)"<BR>SqlConn.Open "Urgent"<BR>Set Query = SqlConn.Execute(strSQL)<BR><BR>SqlConn.Close

  4. #4
    chris horner Guest

    Default RE: Add record to Access Database

    Thanks very much i&#039ll try this tonight and hopfully it will work or should I say I&#039ll get it to work.<BR>Thank again regards Chris.


  5. #5
    Chris Horner Guest

    Default RE: Add record to Access Database

    Thanks very much, I give it a go!<BR>Cheers<BR>Yours truly greatful chris

  6. #6
    Chris Horner Guest

    Default RE: Add record to Access Database

    Thanks very much, I give it a go!<BR>Cheers<BR>Yours truly greatful chris

Posting Permissions

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