473,406 Members | 2,259 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

syntax errpr near parenthesis

syedshaffee
this is my code
Expand|Select|Wrap|Line Numbers
  1. dim i
  2. dim checkboxValue
  3. dim TextBoxValue
  4.  
  5. dim Count
  6. dim Count1
  7. dim postion
  8. dim postion1
  9. position=0
  10. postion1=0
  11. i=0
  12. Checkbox1= Request.Form("same")
  13. strdate=Request.Form("Date")
  14. a=Split(strdate ,",")
  15. b=Split(Checkbox1,",") 
  16. if strdate<>"" and Checkbox1<>"" then
  17. TextBoxValue=UBound(a)
  18. checkboxValue=UBound(b)
  19. 'Response.Write(TextBoxValue)
  20. if TextBoxValue  > checkboxValue then
  21. for i=0 to TextBoxValue
  22. Set objRIMSConn1 = Server.CreateObject("ADODB.Connection")
  23.     objRIMSConn1.Open RIMS_CONNECT
  24.     objRIMSConn1.Execute "Insert into Eot_returned(Asset_id,Date) values("+b(i)+",'"+a(i)+"');"
  25. next
  26. objRIMSConn1.Close
  27.     Set objRIMSConn1 = nothin
  28.     else
  29.     for i=0 to checkboxValue
  30. Set objRIMSConn1 = Server.CreateObject("ADODB.Connection")
  31.     objRIMSConn1.Open RIMS_CONNECT
  32.     objRIMSConn1.Execute "Insert into Eot_returned(Asset_id,Date) values(" +b(i)+ "," +a(i)+ ")"
  33. next
  34. end if
  35.  
  36.     Response.Write("<script language='javascript' type='text/javascript'> alert('The value hass been Inserted'); </script>")
  37.      else
  38.     Response.Write("<script language='javascript' type='text/javascript'> alert('Do you want to return any asset'); </script>")
  39. end if
Erro:Near ")" please an u people help me???????????
Attached Files
File Type: txt Code.txt (1.1 KB, 387 views)
Jan 26 '12 #1
18 2176
Rabbit
12,516 Expert Mod 8TB
You've only defined one field to insert into but you include two values.
Jan 26 '12 #2
yes i can but the problem is in two its giving an error
Jan 26 '12 #3
Rabbit
12,516 Expert Mod 8TB
I have no idea what you're saying. I'm saying that you can't specify two values when you only specify one column.
Jan 26 '12 #4
you have no space between ")" and "values"
if you want any help, it's better to post the full error message.
you can get the error message with
response.write err.description
Jan 26 '12 #5
thnaks u guys and mlutinett i will post the full error message
Jan 26 '12 #6
jhardman
3,406 Expert 2GB
Rabbit is definitely right: the insert statement has the wrong number of fields.
If you were inserting into just one field the command would look like this:
Expand|Select|Wrap|Line Numbers
  1. insert into eot_returned (asset_id) values (4)
but if you were inserting into two different fields, the command would look like this:
Expand|Select|Wrap|Line Numbers
  1. insert into eot_returned (asset_id, asset_name) values (4, 'John')
If you were trying to insert into one field but two different records, you would need two different insert statements
Expand|Select|Wrap|Line Numbers
  1. insert into eot_returned (asset_id) values (4);
  2. insert into eot_returned (asset_id) values (5)
the way you have it is definitely wrong, but I can't tell which you are trying to do.

Jared
Jan 26 '12 #7
jhardman i have changed the code and still it is giving me an error the following is the error:

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near ')'.
, line 876
Jan 27 '12 #8
OKAY now the values are going to the database but its still displaying the same page
Jan 27 '12 #9
Rabbit
12,516 Expert Mod 8TB
What do you mean it displays the same page?
Jan 27 '12 #10
the error page in asp
syedshaffee
re: syntax errpr near parenthesis
jhardman i have changed the code and still it is giving me an error the following is the error:

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near ')'.
but the date time column in sql is like 1/01/1900 for each column
Jan 28 '12 #11
Rabbit
12,516 Expert Mod 8TB
You said the data was going into the database, it shouldn't be giving you an error message if it was. Are you sure the data is getting there?
Jan 28 '12 #12
yes i checked it even i'm wondering how???? is this possible
Jan 28 '12 #13
Rabbit
12,516 Expert Mod 8TB
It would help to see the updated code.
Jan 29 '12 #14
here is the code that is edited
Expand|Select|Wrap|Line Numbers
  1. dim i
  2. dim checkboxValue
  3. dim TextBoxValue
  4.  
  5. dim Count
  6. dim Count1
  7. dim postion
  8. dim postion1
  9. position=0
  10. postion1=0
  11. i=0
  12. Checkbox1= Request.Form("same")
  13. strdate=Request.Form("Date")
  14. a=Split(strdate ,",")
  15. b=Split(Checkbox1,",")
  16.  
  17. if strdate<>"" and Checkbox1<>"" then
  18. TextBoxValue=UBound(a)
  19. checkboxValue=UBound(b)
  20. 'Response.Write(TextBoxValue)
  21. while not rstAssetdesc.EOF
  22. Des = rstAssetdesc("Asset_type_description")
  23. if TextBoxValue  > checkboxValue then
  24. for i=0 to  checkboxValue
  25.  
  26. objRIMSConn.Execute "Insert into Eot_returned (Contract_no,Eot_action,Asset_id,Asset_description,Date) values ('" + Session("Contract_no") + "','" + Session("EotAction") + "'," + b(i) + ",'" + Desc + "', '" + a(i)+ "');"
  27. next
  28.  
  29.     else
  30.     for i=0 to TextBoxValue
  31.     objRIMSConn.Execute "Insert into Eot_returned (Contract_no,Eot_action,Asset_id,Asset_description,Date) values ('" + Session("Contract_no") + "','" + Session("EotAction") + "'," + b(i) + ",'" + Desc + "', '" + a(i)+ "');"
  32. next
  33. end if
  34. Response.Write("<script language='javascript' type='text/javascript'> alert('The value hass been Inserted'); </script>")
  35.      else
  36.     Response.Write("<script language='javascript' type='text/javascript'> alert('Do you want to return any asset'); </script>")
  37. end if 
  38.  
Jan 30 '12 #15
Rabbit
12,516 Expert Mod 8TB
date is a reserved keyword. If you're going to use it as a field name, you need to demarcate it as such. Different DBMS will have different methods of demarcation. So you'll need to look up the method for your particular DBMS.
Jan 30 '12 #16
ok i checked that and i changed the name of the field but now can u help me with the loop b'coz the values are doubled in the table
Jan 30 '12 #17
Rabbit
12,516 Expert Mod 8TB
I have no idea what values are being passed and what your intentions are. I can't help without knowing those.
Jan 30 '12 #18
jhardman
3,406 Expert 2GB
OK, this is a really useful technique I have been doing for over 10 years whenever I don't get the response from the db that I expect:

print out (output to the screen) the SQL statement instead of sending it to the dbms. That way you can look at it and see where it is going wrong. 90% of the time as soon as you look at it you can tell why you are getting a funny response like getting two records added instead of one.

Jared
Feb 10 '12 #19

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Trevor Sather | last post by:
------=_NextPart_000_004D_01C3456C.66EFEC50 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Hello The following query used to work when I was using an Access...
19
by: Nicolas Fleury | last post by:
Hi everyone, I would to know what do you think of this PEP. Any comment welcomed (even about English mistakes). PEP: XXX Title: Specialization Syntax Version: $Revision: 1.10 $...
5
by: r.nikhilk | last post by:
Hi, Currently, we are porting C++ applications from 32 bit to 64 bit on AIX platform. (The current version of AIX is 5.3 and xlC verison is 8.0). We are able to compile the applications by...
1
by: obastard | last post by:
Hi Having a problem with a ms sql 2000 server. The script below was created i SQL manager 2005 lite and gives a syntax error near '(' ALTER TABLE . ADD CONSTRAINT PRIMARY KEY CLUSTERED ()...
2
by: ielmrani via SQLMonster.com | last post by:
Hi Everyone, I really tried to not post this question but I gave up. I tried brackets, parenth...etc but nothing worked. I get this error message: Incorrect syntax near the keyword 'THEN'. ...
1
by: gatorfalcon | last post by:
I'm using mysqli_multi_query to run multiple queries concatenated with a semicolon that I set using the HEREDOC format. What's weird is that this works fine on my development system on my laptop...
2
by: Shrutisinha | last post by:
I am getting this error in unix .. syntax error near unexpected token `(' when i am running my parser , can anybody help me plzz .. i am new to all this thanks
3
by: silambu | last post by:
hi,can anybody tell reason for getting syntax error near , while either updating or inserting records in table
4
by: bhunesh | last post by:
hey , i m getting error listed below plz help me /virtualHosts/beta.myiris.com/htdocs/commodities/commd_admin/CRONJOB/new_cronjob/new_mcx.pl: line 14: syntax error near unexpected token...
4
by: cluce | last post by:
I am getting a syntax error but I cant seem to spot it. need help with this. Its when I click the save button that fires my SQL UPDATE query. thansk in advance 'module level declarations Dim...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.