SQL-INCLUDE

Author Message
mchukans

  • Total Posts : 2
  • Scores: 0
  • Reward points : 0
  • Joined: 2/3/2009
  • Status: offline
SQL-INCLUDE Tuesday, February 03, 2009 9:42 PM (permalink)
0
Hey does someone have any idea why this script doesn't work? I'm trying to add data in an acces database with Asp (VBScript):
 

Sub
Process_Anywhere()

Dim dcnDB 'As ADODB.Connection

Dim rsDB 'As ADODB.Recordset

Dim sqlInsert As String
Dim filePath As String
'Find path of database file

filePath = Server.MapPath(
"C:\APPLS\Test\umfrage.mdb")
'Open Database Connection

Set dcnDB = Server.CREATEOBJECT("ADODB.Connection")
'dcnDB.Open "DBName" - This is for an ODBC Datasource (if set up) or

' use the below code for opening a Access 2000 DB

dcnDB.ConnectionString =
"Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & filePath
dcnDB.Open
'Check for action

If Request.Form("action") = "Insert" Then


'Create SQL INSERT statement from form fields

sqlInsert =
"INSERT INTO umfrage1 (Zufriedenheit) VALUES (" GCT:question1")"


'Execute the query

dcnDB.Execute(sqlInsert)

End If

End Sub
 

 
#1
    webber123456

    • Total Posts : 58
    • Scores: 0
    • Reward points : 0
    • Joined: 9/20/2007
    • Status: offline
    RE: SQL-INCLUDE Wednesday, February 04, 2009 9:07 AM (permalink)
    0
     server.mapPath converts virtual path to physical path.  You already have the physical path so just say:

    filePath = "C:\APPLS\Test\umfrage.mdb"

    also your quotes are in error here:

    sqlInsert = "INSERT INTO umfrage1 (Zufriedenheit) VALUES (" GCT:question1")"

    use:


    sqlInsert = "INSERT INTO umfrage1 (Zufriedenheit) VALUES (' GCT:question1')"


    <message edited by webber123456 on Wednesday, February 04, 2009 9:09 AM>
     
    #2

      Online Bookmarks Sharing: Share/Bookmark

      Jump to:

      Current active users

      There are 0 members and 1 guests.

      Icon Legend and Permission

      • New Messages
      • No New Messages
      • Hot Topic w/ New Messages
      • Hot Topic w/o New Messages
      • Locked w/ New Messages
      • Locked w/o New Messages
      • Read Message
      • Post New Thread
      • Reply to message
      • Post New Poll
      • Submit Vote
      • Post reward post
      • Delete my own posts
      • Delete my own threads
      • Rate post

      2000-2012 ASPPlayground.NET Forum Version 3.9