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)
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
|
|
|
|
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)
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>
|
|
|
|