473,233 Members | 1,402 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,233 software developers and data experts.

Where to write INSERT query in ASP?????

hi,
i have just started learning ASP. i m doing database connectivity in ASP. my problem is with the insert query.
i have a page "form.asp" for taking input from user. after entering data when user clicks the next button, page "display.asp" have to be displayed. i m using POST method with my form. now i m confused where to write the insert query??? either in form.asp or display.asp??? or there should be an intermediate page between these two pages that contains only the insert query???? i m really confused and want some help.
thanks
Jun 1 '07 #1
3 3783
jhardman
3,406 Expert 2GB
I would definitely put it in display.asp (before writing any data to the web page). There is nothing logically wrong with putting it in a script between the two pages, and I've even done it successfully all on one page, but that involves a big if...else statement:
Expand|Select|Wrap|Line Numbers
  1. if request.form("name") = "" then
  2.    'data hasn't been submitted, so show form
  3. else
  4.    'data has been submitted, so update db
  5.    'afterwards do the display
  6. end if
I guess it's kind of up to you, but I think the easiest is on display.asp

Jared
Jun 1 '07 #2
thanks a lot !!!!!!!!!!!!!

but one more question.....
i am using an autonumber field in my MS access databse as primary key. how can i add values in that field using ASP. if i m not giving any value for that field, it is giving an error message.
Jun 1 '07 #3
jhardman
3,406 Expert 2GB
thanks a lot !!!!!!!!!!!!!

but one more question.....
i am using an autonumber field in my MS access databse as primary key. how can i add values in that field using ASP. if i m not giving any value for that field, it is giving an error message.
hmm. That's odd. I thought if you used an autonumber you just had to ignore that field when updating. Let me give it a think.

I know I simulated an autonumber once by finding the highest number in the table then adding one.

Jared
Jun 1 '07 #4

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

Similar topics

3
by: kiqyou_vf | last post by:
hi guys, first of all i'm really new to php so i apologize ahead of time if this is a noob question. ok, so i purchased and read the PHP for the Wolrd Wide Web by Larry Ullman and started to...
6
by: Kevin Frey | last post by:
Hello, I have a table which contains some nullable columns. I want to write a single query, which can be prepared (ie. prepared statement), that can handle null or non-null values for the where...
5
by: Rachel Weeden | last post by:
I'm working on an ASP Web application, and am having syntax issues in a WHERE statement I'm trying to write that uses the CInt Function on a field. Basically, I want to select records using...
0
by: jtocci | last post by:
I'm having a big problem with CREATE RULE...ON INSERT...INSERT INTO...SELECT...FROM...WHERE when I want to INSERT several (20~50) records based on a single INSERT to a view. Either I get a 'too...
6
by: nicholas | last post by:
I have this in my stored procedure: SET @CatInsert = 'INSERT INTO tbl_shopscats (shopID, categoryID) SELECT ' + CONVERT(varchar,@shopID) + ', categoryID From tbl_categories Where categoryID IN...
9
by: Scott Ribe | last post by:
OK, I'm using a pool of worker threads that each have a connection (from my own software, no PHP or anything like that involved), and a connection is in a state where all queries fail. Looking back...
7
by: Swinky | last post by:
Mr. Browne's copy code on his web site has saved me. I have been struggling to copy a record with several related sub-form tables. I found code on his web site that copies a sub-form table,...
2
by: Himmel | last post by:
Hello! The reference database I currently use runs queries that pull data from hundreds of tables in order to create user-friendly form view. The problem is that these queries can take upwards of...
4
by: MLH | last post by:
Suppose you're using a query to update or append many records in a large table. And suppose one of those fields is a T/D stamp table and you're using Now() to write its value. It is conceivable...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

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.