Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsOtherProgramming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old June 4th, 2006, 05:31 PM
dtritle dtritle is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jun 2006
Posts: 3 dtritle User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 16 m 43 sec
Reputation Power: 0
Help with my code - Syntax Error

I keep getting a syntax error with the following insert statement but I can not figure out why. Can anyone please help. The only value that is not going into a text field is zip. Thanks in advance.


Code:
<%
set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open ConString

sql = "insert into clients (companyName,domain,address,address2,city,state,zi  p,comments,phone)"

sql = sql & " values( " & companyName & " , " & domain & " , " & address1 & " , " & address2 & " , " & city & " , " & state & " , '" & zip & "' , " & comments & " , " & phone & ")" 

Conn.Execute(sql)
%>

Reply With Quote
  #2  
Old June 4th, 2006, 05:41 PM
lewy's Avatar
lewy lewy is offline
Alter Ego Wizard
ASP Free Specialist (4000 - 4499 posts)
 
Join Date: Jun 2004
Location: Edinburg Tx
Posts: 4,376 lewy User rank is General 6th Grade (Above 100000 Reputation Level)lewy User rank is General 6th Grade (Above 100000 Reputation Level)lewy User rank is General 6th Grade (Above 100000 Reputation Level)lewy User rank is General 6th Grade (Above 100000 Reputation Level)lewy User rank is General 6th Grade (Above 100000 Reputation Level)lewy User rank is General 6th Grade (Above 100000 Reputation Level)lewy User rank is General 6th Grade (Above 100000 Reputation Level)lewy User rank is General 6th Grade (Above 100000 Reputation Level)lewy User rank is General 6th Grade (Above 100000 Reputation Level)lewy User rank is General 6th Grade (Above 100000 Reputation Level)lewy User rank is General 6th Grade (Above 100000 Reputation Level)lewy User rank is General 6th Grade (Above 100000 Reputation Level)lewy User rank is General 6th Grade (Above 100000 Reputation Level)lewy User rank is General 6th Grade (Above 100000 Reputation Level)lewy User rank is General 6th Grade (Above 100000 Reputation Level)lewy User rank is General 6th Grade (Above 100000 Reputation Level)  Folding Points: 1009 Folding Title: Novice Folder
Time spent in forums: 1 Month 1 Week 1 Day 21 h 21 m 31 sec
Reputation Power: 1391
Welcome to the forums

this part of you sql statement is wrong:

it should be:
Code:
sql = sql & " values( '" & companyName & "' , '" & domain & "' , '" & address1 & "' , '" & address2 & "' , '" & city & "' , '" & state & "' , " & zip & " , '" & comments & "' , '" & phone & "')" 

As you mentioned, if zip is the only numeric field then in your sql it should be between " & zip & " .... character fields should be between '" & yourcharfield & "' and so on.

Almost correct, you just had it backwards
__________________
................... ASCII and ye shall receive ..................
Knowledge is the only resource on earth that multiplies when shared


Support the Shemzilla Project
Powered by C#

Reply With Quote
  #3  
Old June 4th, 2006, 06:01 PM
dtritle dtritle is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jun 2006
Posts: 3 dtritle User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 16 m 43 sec
Reputation Power: 0
wow I guess I was just not paying attention there, thanks. But for some reason still a syntax error in the same SQL statement. Any ideas. Thanks again.

Reply With Quote
  #4  
Old June 4th, 2006, 07:32 PM
dtritle dtritle is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jun 2006
Posts: 3 dtritle User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 16 m 43 sec
Reputation Power: 0
Ok. I have it narrowed down a little. It has something to do with the domain field. I took all the objects out and put them back one by one and did not get a syntax error until the domain was inserted. I took domain out and added everything else back in and it works fine. I tried to rename the variable, in case domain was a reserved name, and it still does not work.

Domain is a text field in my database and I am trying to insert text. I am using the value ' " & domainURL & " '. Does anyone have any idea what is going on.

Reply With Quote
  #5  
Old June 4th, 2006, 09:21 PM
lewy's Avatar
lewy lewy is offline
Alter Ego Wizard
ASP Free Specialist (4000 - 4499 posts)
 
Join Date: Jun 2004
Location: Edinburg Tx
Posts: 4,376 lewy User rank is General 6th Grade (Above 100000 Reputation Level)lewy User rank is General 6th Grade (Above 100000 Reputation Level)lewy User rank is General 6th Grade (Above 100000 Reputation Level)lewy User rank is General 6th Grade (Above 100000 Reputation Level)lewy User rank is General 6th Grade (Above 100000 Reputation Level)lewy User rank is General 6th Grade (Above 100000 Reputation Level)lewy User rank is General 6th Grade (Above 100000 Reputation Level)lewy User rank is General 6th Grade (Above 100000 Reputation Level)lewy User rank is General 6th Grade (Above 100000 Reputation Level)lewy User rank is General 6th Grade (Above 100000 Reputation Level)lewy User rank is General 6th Grade (Above 100000 Reputation Level)lewy User rank is General 6th Grade (Above 100000 Reputation Level)lewy User rank is General 6th Grade (Above 100000 Reputation Level)lewy User rank is General 6th Grade (Above 100000 Reputation Level)lewy User rank is General 6th Grade (Above 100000 Reputation Level)lewy User rank is General 6th Grade (Above 100000 Reputation Level)  Folding Points: 1009 Folding Title: Novice Folder
Time spent in forums: 1 Month 1 Week 1 Day 21 h 21 m 31 sec
Reputation Power: 1391
Right before this line:
Conn.Execute(sql)

do a
Response.Write sql
Response.End()


and check if the sql statement looks correct.
It's always helpful to see what your sql statement looks like, especially if it's giving you problems

Post the result

Reply With Quote
  #6  
Old June 5th, 2006, 01:43 AM
pmlakshmis pmlakshmis is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: May 2006
Posts: 21 pmlakshmis User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 7 m 47 sec
Reputation Power: 0
what is the error msg , that u get

Reply With Quote
Reply

Viewing: ASP Free ForumsOtherProgramming Help > Help with my code - Syntax Error


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway