this is my code -
dim i
-
dim checkboxValue
-
dim TextBoxValue
-
-
dim Count
-
dim Count1
-
dim postion
-
dim postion1
-
position=0
-
postion1=0
-
i=0
-
Checkbox1= Request.Form("same")
-
strdate=Request.Form("Date")
-
a=Split(strdate ,",")
-
b=Split(Checkbox1,",")
-
if strdate<>"" and Checkbox1<>"" then
-
TextBoxValue=UBound(a)
-
checkboxValue=UBound(b)
-
'Response.Write(TextBoxValue)
-
if TextBoxValue > checkboxValue then
-
for i=0 to TextBoxValue
-
Set objRIMSConn1 = Server.CreateObject("ADODB.Connection")
-
objRIMSConn1.Open RIMS_CONNECT
-
objRIMSConn1.Execute "Insert into Eot_returned(Asset_id,Date) values("+b(i)+",'"+a(i)+"');"
-
next
-
objRIMSConn1.Close
-
Set objRIMSConn1 = nothin
-
else
-
for i=0 to checkboxValue
-
Set objRIMSConn1 = Server.CreateObject("ADODB.Connection")
-
objRIMSConn1.Open RIMS_CONNECT
-
objRIMSConn1.Execute "Insert into Eot_returned(Asset_id,Date) values(" +b(i)+ "," +a(i)+ ")"
-
next
-
end if
-
-
Response.Write("<script language='javascript' type='text/javascript'> alert('The value hass been Inserted'); </script>")
-
else
-
Response.Write("<script language='javascript' type='text/javascript'> alert('Do you want to return any asset'); </script>")
-
end if
Erro:Near ")" please an u people help me???????????
18 2176
You've only defined one field to insert into but you include two values.
yes i can but the problem is in two its giving an error
I have no idea what you're saying. I'm saying that you can't specify two values when you only specify one column.
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
thnaks u guys and mlutinett i will post the full error message
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: - insert into eot_returned (asset_id) values (4)
but if you were inserting into two different fields, the command would look like this: - 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 - insert into eot_returned (asset_id) values (4);
-
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
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
OKAY now the values are going to the database but its still displaying the same page
What do you mean it displays the same page?
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
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?
yes i checked it even i'm wondering how???? is this possible
It would help to see the updated code.
here is the code that is edited - dim i
-
dim checkboxValue
-
dim TextBoxValue
-
-
dim Count
-
dim Count1
-
dim postion
-
dim postion1
-
position=0
-
postion1=0
-
i=0
-
Checkbox1= Request.Form("same")
-
strdate=Request.Form("Date")
-
a=Split(strdate ,",")
-
b=Split(Checkbox1,",")
-
-
if strdate<>"" and Checkbox1<>"" then
-
TextBoxValue=UBound(a)
-
checkboxValue=UBound(b)
-
'Response.Write(TextBoxValue)
-
while not rstAssetdesc.EOF
-
Des = rstAssetdesc("Asset_type_description")
-
if TextBoxValue > checkboxValue then
-
for i=0 to checkboxValue
-
-
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)+ "');"
-
next
-
-
else
-
for i=0 to TextBoxValue
-
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)+ "');"
-
next
-
end if
-
Response.Write("<script language='javascript' type='text/javascript'> alert('The value hass been Inserted'); </script>")
-
else
-
Response.Write("<script language='javascript' type='text/javascript'> alert('Do you want to return any asset'); </script>")
-
end if
-
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.
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
I have no idea what values are being passed and what your intentions are. I can't help without knowing those.
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
Sign in to post your reply or Sign up for a free account.
Similar topics
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...
|
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 $...
|
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...
|
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 ()...
|
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'. ...
|
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...
|
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
|
by: silambu |
last post by:
hi,can anybody tell reason for getting syntax error near , while either updating or inserting records in table
|
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...
|
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...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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,...
|
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...
|
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,...
|
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,...
| |