Current location: Hot Scripts Forums » Programming Languages » ASP » Syntax error (missing operator) in query expression


Syntax error (missing operator) in query expression

Reply
  #1 (permalink)  
Old 11-23-03, 11: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"
%>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 11-23-03, 02:36 PM
MadDog MadDog is offline
Code Master
 
Join Date: Aug 2003
Posts: 935
Thanks: 0
Thanked 0 Times in 0 Posts
'Short Descripton" can not have a space in it. So remove the space or add "_" in the spot of the space.
__________________
Drew Gauderman
ASP - MSSQL Coder / Buisness Owner / Coder for Hire!
MSN-ICQ-AIM-YIM in Profile

http://www.iportalx.net an easy ASP portal system.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 11-23-03, 04:48 PM
crobinson's Avatar
crobinson crobinson is offline
Newbie Coder
 
Join Date: Nov 2003
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by MadDog
'Short Descripton" can not have a space in it. So remove the space or add "_" in the spot of the space.

I did that but I think I have to do it to the corresponding table in the database ??
Ill try.......Thanks for the quick response.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #4 (permalink)  
Old 11-23-03, 08:13 PM
MadDog MadDog is offline
Code Master
 
Join Date: Aug 2003
Posts: 935
Thanks: 0
Thanked 0 Times in 0 Posts
>> did that but I think I have to do it to the corresponding table in the database ??

Yes you do. You also have to do it in your asp scripts.
__________________
Drew Gauderman
ASP - MSSQL Coder / Buisness Owner / Coder for Hire!
MSN-ICQ-AIM-YIM in Profile

http://www.iportalx.net an easy ASP portal system.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #5 (permalink)  
Old 11-23-03, 09:49 PM
crobinson's Avatar
crobinson crobinson is offline
Newbie Coder
 
Join Date: Nov 2003
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Talking

Quote:
Originally Posted by MadDog
>> did that but I think I have to do it to the corresponding table in the database ??

Yes you do. You also have to do it in your asp scripts.
Well it got rid of the error but hten I got another but it works now. Thnx for the help.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump


All times are GMT -5. The time now is 01:29 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.