472,135 Members | 1,248 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,135 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 3717
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

Post your reply

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

Similar topics

3 posts views Thread by kiqyou_vf | last post: by
5 posts views Thread by Rachel Weeden | last post: by
6 posts views Thread by nicholas | last post: by
7 posts views Thread by Swinky | last post: by
reply views Thread by leo001 | last post: by

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.