Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 13th, 2004, 05:14 AM
Friend of Wrox
 
Join Date: Oct 2003
Posts: 463
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to madhukp
Default

No, I mean the runtime query which creates the problem. Instead of executing the problem creating query, please print it to browser and post it here.
 
Old October 13th, 2004, 06:07 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 518
Thanks: 0
Thanked 0 Times in 0 Posts
Default

sorry, I could not understand runtime query.
problem in insert query, as posted above.

you means, error display on the browser ?
browser message is following.

Technical Information (for support personnel)
Error Type:
Microsoft VBScript runtime (0x800A000D)
Type mismatch: 'astrdate'
/sas/projassign/add_passignedit.asp, line 50

Browser Type:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 1.0.3705)

Page:
POST 1100 bytes to /sas/projassign/add_passignedit.asp

POST Data:
contract=229&empno=72312+++++&aposit=Resident+Engi neer&acontract=229&astrdate=8%2F1%2F2004&aenddate= 8%2F31%2F2004&cshift=&empno=82108+++++&aposit=Quan tity+Surveyor&acontract=221&astrdate=8%2F1%2F2004& . . .


Mateen


 
Old October 13th, 2004, 06:19 AM
Friend of Wrox
 
Join Date: Oct 2003
Posts: 463
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to madhukp
Default

Hello Mateen,

Sorry for the confusion.

Just have Response.Write(sql) at line 50 (instead of cn.Execute sql). It will print the query creating problem.

Please post that query. This will help diagnos the problem fast
 
Old October 13th, 2004, 06:36 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 518
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi, Madhu,
it is ten rows and six columns informations.

insert into assignments2 (empno,aposit,astrdate,aendate,acontract) values ('72312 ','Resident Engineer, Quantity Surveyor, Surveyor, Inspector (As-built), Inspector, Inspector, Technician, Secretary, Clerk / Expeditor, Driver','8/1/2004, 8/1/2004, 8/1/2004, 8/1/2004, 8/1/2004, 8/1/2004, 8/1/2004, 8/1/2004, 8/1/2004, 8/1/2004','8/31/2004, 8/31/2004, 8/31/2004, 8/31/2004, 8/31/2004, 8/31/2004, 8/31/2004, 8/31/2004, 8/31/2004, 8/31/2004','229, 221, 229, Main Office, 229, 229, 982, 2002, Main Office, Main Office')
insert into assignments2 (empno,aposit,astrdate,aendate,acontract) values ('82108 ','Resident Engineer, Quantity Surveyor, Surveyor, Inspector (As-built), Inspector, Inspector, Technician, Secretary, Clerk / Expeditor, Driver','8/1/2004, 8/1/2004, 8/1/2004, 8/1/2004, 8/1/2004, 8/1/2004, 8/1/2004, 8/1/2004, 8/1/2004, 8/1/2004','8/31/2004, 8/31/2004, 8/31/2004, 8/31/2004, 8/31/2004, 8/31/2004, 8/31/2004, 8/31/2004, 8/31/2004, 8/31/2004','229, 221, 229, Main Office, 229, 229, 982, 2002, Main Office, Main Office')
insert into assignments2 (empno,aposit,astrdate,aendate,acontract) values ('36699 ','Resident Engineer, Quantity Surveyor, Surveyor, Inspector (As-built), Inspector, Inspector, Technician, Secretary, Clerk / Expeditor, Driver','8/1/2004, 8/1/2004, 8/1/2004, 8/1/2004, 8/1/2004, 8/1/2004, 8/1/2004, 8/1/2004, 8/1/2004, 8/1/2004','8/31/2004, 8/31/2004, 8/31/2004, 8/31/2004, 8/31/2004, 8/31/2004, 8/31/2004, 8/31/2004, 8/31/2004, 8/31/2004','229, 221, 229, Main Office, 229, 229, 982, 2002, Main Office, Main Office')
insert into assignments2 (empno,aposit,astrdate,aendate,acontract) values ('81967 ','Resident Engineer, Quantity Surveyor, Surveyor, Inspector (As-built), Inspector, Inspector, Technician, Secretary, Clerk / Expeditor, Driver','8/1/2004, 8/1/2004, 8/1/2004, 8/1/2004, 8/1/2004, 8/1/2004, 8/1/2004, 8/1/2004, 8/1/2004, 8/1/2004','8/31/2004, 8/31/2004, 8/31/2004, 8/31/2004, 8/31/2004, 8/31/2004, 8/31/2004, 8/31/2004, 8/31/2004, 8/31/2004','229, 221, 229, Main Office, 229, 229, 982, 2002, Main Office, Main Office')
insert into assignments2 (empno,aposit,astrdate,aendate,acontract) values ('03068 ','Resident Engineer, Quantity Surveyor, Surveyor, Inspector (As-built), Inspector, Inspector, Technician, Secretary, Clerk / Expeditor, Driver','8/1/2004, 8/1/2004, 8/1/2004, 8/1/2004, 8/1/2004, 8/1/2004, 8/1/2004, 8/1/2004, 8/1/2004, 8/1/2004','8/31/2004, 8/31/2004, 8/31/2004, 8/31/2004, 8/31/2004, 8/31/2004, 8/31/2004, 8/31/2004, 8/31/2004, 8/31/2004','229, 221, 229, Main Office, 229, 229, 982, 2002, Main Office, Main Office')
insert into assignments2 (empno,aposit,astrdate,aendate,acontract) values ('08979 ','Resident Engineer, Quantity Surveyor, Surveyor, Inspector (As-built), Inspector, Inspector, Technician, Secretary, Clerk / Expeditor, Driver','8/1/2004, 8/1/2004, 8/1/2004, 8/1/2004, 8/1/2004, 8/1/2004, 8/1/2004, 8/1/2004, 8/1/2004, 8/1/2004','8/31/2004, 8/31/2004, 8/31/2004, 8/31/2004, 8/31/2004, 8/31/2004, 8/31/2004, 8/31/2004, 8/31/2004, 8/31/2004','229, 221, 229, Main Office, 229, 229, 982, 2002, Main Office, Main Office')
insert into assignments2 (empno,aposit,astrdate,aendate,acontract) values ('34996 ','Resident Engineer, Quantity Surveyor, Surveyor, Inspector (As-built), Inspector, Inspector, Technician, Secretary, Clerk / Expeditor, Driver','8/1/2004, 8/1/2004, 8/1/2004, 8/1/2004, 8/1/2004, 8/1/2004, 8/1/2004, 8/1/2004, 8/1/2004, 8/1/2004','8/31/2004, 8/31/2004, 8/31/2004, 8/31/2004, 8/31/2004, 8/31/2004, 8/31/2004, 8/31/2004, 8/31/2004, 8/31/2004','229, 221, 229, Main Office, 229, 229, 982, 2002, Main Office, Main Office')
insert into assignments2 (empno,aposit,astrdate,aendate,acontract) values ('34753 ','Resident Engineer, Quantity Surveyor, Surveyor, Inspector (As-built), Inspector, Inspector, Technician, Secretary, Clerk / Expeditor, Driver','8/1/2004, 8/1/2004, 8/1/2004, 8/1/2004, 8/1/2004, 8/1/2004, 8/1/2004, 8/1/2004, 8/1/2004, 8/1/2004','8/31/2004, 8/31/2004, 8/31/2004, 8/31/2004, 8/31/2004, 8/31/2004, 8/31/2004, 8/31/2004, 8/31/2004, 8/31/2004','229, 221, 229, Main Office, 229, 229, 982, 2002, Main Office, Main Office')
insert into assignments2 (empno,aposit,astrdate,aendate,acontract) values ('37747 ','Resident Engineer, Quantity Surveyor, Surveyor, Inspector (As-built), Inspector, Inspector, Technician, Secretary, Clerk / Expeditor, Driver','8/1/2004, 8/1/2004, 8/1/2004, 8/1/2004, 8/1/2004, 8/1/2004, 8/1/2004, 8/1/2004, 8/1/2004, 8/1/2004','8/31/2004, 8/31/2004, 8/31/2004, 8/31/2004, 8/31/2004, 8/31/2004, 8/31/2004, 8/31/2004, 8/31/2004, 8/31/2004','229, 221, 229, Main Office, 229, 229, 982, 2002, Main Office, Main Office')
insert into assignments2 (empno,aposit,astrdate,aendate,acontract) values ('82073 ','Resident Engineer, Quantity Surveyor, Surveyor, Inspector (As-built), Inspector, Inspector, Technician, Secretary, Clerk / Expeditor, Driver','8/1/2004, 8/1/2004, 8/1/2004, 8/1/2004, 8/1/2004, 8/1/2004, 8/1/2004, 8/1/2004, 8/1/2004, 8/1/2004','8/31/2004, 8/31/2004, 8/31/2004, 8/31/2004, 8/31/2004, 8/31/2004, 8/31/2004, 8/31/2004, 8/31/2004, 8/31/2004','229, 221, 229, Main Office, 229, 229, 982, 2002, Main Office, Main Office')
insert into assignments2 (empno,aposit,astrdate,aendate,acontract) values ('82073 ','Resident Engineer, Quantity Surveyor, Surveyor, Inspector (As-built), Inspector, Inspector, Technician, Secretary, Clerk / Expeditor, Driver','8/1/2004, 8/1/2004, 8/1/2004, 8/1/2004, 8/1/2004, 8/1/2004, 8/1/2004, 8/1/2004, 8/1/2004, 8/1/2004','8/31/2004, 8/31/2004, 8/31/2004, 8/31/2004, 8/31/2004, 8/31/2004, 8/31/2004, 8/31/2004, 8/31/2004, 8/31/2004','229, 221, 229, Main Office, 229, 229, 982, 2002, Main Office, Main Office')


thanks for your cooperation.

 
Old October 13th, 2004, 07:46 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 518
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks all of you.
Thurday and Friday our office will remain close.

I will try to solve some othere solution to insert the multiple records.
by the Access form retrived multiple records and insert.
for this, create link with the sql server tables with the Access db.

Regards.

Mateen



 
Old October 13th, 2004, 08:28 AM
Friend of Wrox
 
Join Date: Oct 2003
Posts: 463
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to madhukp
Default

Hello Mateen,

If I am correct, you are trying to add a set of dates to a field with data type datetime. This is not possible.

As far as I could understand, you are trying to store the assignment start date and assignment end date of a set of employees altogether.

You may be using a form with 50 sets of fields (not 50 fields) to collect the details for each employee. This means the same form is repeated for each employee. You are erroneously using the same name for corresponding fields of any two such set of fields.

For e.g. You have a text box with name aposit. There are other fields with the same name for the second employee. then the name is repeated for the set of fields for 3rd employee etc. etc. So all the values in them are getting collected to a single big string seperated by comma. You have to use different name for each form field. You can append a number to them to make them unique. Something like aposit1, aposit2 etc.

Then you need to collect these values inside the loop as
Request.Form("aposit" & x) etc. etc.

Hope you understood this.
 
Old October 13th, 2004, 08:38 AM
Friend of Wrox
 
Join Date: Oct 2003
Posts: 463
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to madhukp
Default

Let me give you some more simplified explanation.

Suppose you have a form with two text boxes. If both of them happens to have same name, say txtName, then when the form is submitted, in the action page you will get it like this.

Request.Form("txtName") will give madhu,mateen where madhu is the name entered in text box 1 and mateen is the name entered in text box 2. You have to use txtName1 and txtName2 as the names of these fields.

This usually happens in a grid of controls. You have to append the row number of grid to name of each control in that row.
 
Old October 14th, 2004, 01:17 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

mateenmohd,

Looks like astrdate and aenddate are having set of values, not a single value, as per the query that you have printed on one of your posts. You got to figure out the way to insert one value for each at a time. Within insert, you are trying to insert values for just 5 columns, wherein you are passing values more than 5 columns, which in anyways would fail.

Hope that helps.
Cheers!

_________________________
- Vijay G
Strive for Perfection
 
Old October 16th, 2004, 04:35 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 518
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thanks for response.
you may be right.
but problem still same. how can insert multiple values into tables ?
there are any other method, coding ?
so that data entries will past, just changing minor data, remaining data
will remain same, how can do it ?

ie. values recived like this.
101, 102,103,.....
RE,Clerk,Manager,.....
16/10/2004,15/10/2004,14/10/2004,......
30/10/2004,30/10/2004,30/10/2004,.....
First, Second, First, Second,.........

how can can insert above multiple values into tables ?

5 columns data recived and I trying to insert 5 columns data into the
table, one field was wrong copy from the old asp file.

Basic problem is that how can insert past entries ?
any suggust ? if send coding will be highly appreciated.

regards.

Mateen



 
Old October 18th, 2004, 01:22 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 518
Thanks: 0
Thanked 0 Times in 0 Posts
Default

My multiple insert data problem solve.
I use following coding to insert multiple records. there are no error.
records properly insert into the table.

for x = 1 to Request.Form("empno").Count
ssql="select empno from assignments2 where empno='"& Request.Form("empno").Item(x) &"'"
next

set rs=cn.Execute(ssql)
if not rs.eof then

for x = 1 to Request.Form("empno").Count
    sql ="insert into assignments2 (empno,aposit,acontract,astrdate,aenddate) values ("
    sql =sql & "'" & Request.Form("empno").Item(x) & "','" & Request.Form("aposit").Item(x) & "','" & Request.Form("acontract").Item(x) & "','" & Request.Form("astrdate").Item(x) & "','" & Request.Form("aenddate").Item(x) & "')"

cn.Execute sql

next

--------------------------------------------------


but I have another problem during insert the multiple records.
ie. I received 10 rows data from the previous page. ie as posted above.

some time I want to insert only 9 rows data or 8 rows data, I remove the one row data
and then click the insert button, it move to next page ie above coding, it start counting the empno.
if it count 10 empno then it easily insert the records no error, if it count empno is 9 records
then It display nothing, blank page display. ie it not come out from the loop.

How can solve this problem that if retrieve 10 row data, but I want to insert only 9 rows data,
one row data I remove, it should be count 9 empno records and insert 9 empno records data ?
but it always count 10 empno it should be count 9 empno because I want to insert only 9 empno row data how ?
one empno row data I remove, I want to insert 9 empno data.

how can control / solve this ?

regards.

Mateen





Similar Threads
Thread Thread Starter Forum Replies Last Post
Insert multiple records from form lorirobn Access 2 April 9th, 2007 03:08 PM
insert multiple records into a table from values Deepak Chauhan Oracle 3 May 12th, 2006 10:35 PM
Insert multiple records mateenmohd Access 13 November 2nd, 2004 09:15 AM
Insert multiple records in a Inner Join Table rylemer Access VBA 0 July 19th, 2004 03:54 PM
Best way to insert multiple records koo9 ADO.NET 2 June 28th, 2003 08:37 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.