View Single Post
  #1 (permalink)  
Old 11-23-03, 10:26 AM
crobinson's Avatar
crobinson crobinson is offline
Newbie Coder
 
Join Date: Nov 2003
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Cool Syntax error (missing operator) in query expression

This is the error I am getting. Can somebody please help me out. Its probably something stupid I did wrong.

Syntax error (missing operator) in query expression 'tblknowbase.Short Descripton".
/knowbase/add_to_knowledge_base.asp, line 32



Here is the ASP Code:

<%@ Language=VBScript %>
<%
<!-- #include file="adovbs.inc" -->

'Dimension variables
Dim adoCon 'Holds the Database Connection Object
Dim rsAddComments 'Holds the recordset for the new record to be added to the database
Dim strSQL 'Holds the SQL query for the database

'Create an ADO connection odject
Set adoCon = Server.CreateObject("ADODB.Connection")

'Set an active connection to the Connection object using a DSN-less connection
adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("knowbase.mdb")

'Set an active connection to the Connection object using DSN connection
'adoCon.Open "DSN=knowbase"

'Create an ADO recordset object
Set rsAddComments = Server.CreateObject("ADODB.Recordset")

'Initialise the strSQL variable with an SQL statement to query the database
strSQL = "SELECT tblknowbase.Date, tblknowbase.Short Description, tblknowbase.Long Description, tblknowbase.Category, tblknowbase.Links FROM tblknowbase;"

'Set the cursor type we are using so we can navigate through the recordset
rsAddComments.CursorType = 2

'Set the lock type so that the record is locked by ADO when it is updated
rsAddComments.LockType = 3

'Open the tblknowbase table using the SQL query held in the strSQL varaiable
rsAddComments.Open strSQL, adoCon

'Tell the recordset we are adding a new record to it
rsAddComments.AddNew

'Add a new record to the recordset
rsAddComments.Fields("Date") = Request.Form("Date")
rsAddComments.Fields("Short Description") = Request.Form("Short Description")
rsAddComments.Fields("Long Description") = Request.Form("Long Description")
rsAddComments.Fields("Category") = Request.Form("Category")
rsAddComments.Fields("Links") = Request.Form("Links")

'Write the updated recordset to the database
rsAddComments.Update

'Reset server objects
rsAddComments.Close
Set rsAddComments = Nothing
Set adoCon = Nothing

'Redirect to the knowledge_base.asp page
Response.Redirect "knowledge_base.asp"
%>
Reply With Quote