473,811 Members | 2,038 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

26 New Member
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.as p" 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 3808
jhardman
3,406 Recognized Expert Specialist
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
star111792
26 New Member
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 Recognized Expert Specialist
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
1650
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 write my own script. im trying to write a script that searches through a company name column (co_name) and returns the row- simple. here is a snippet: if (isset ($_GET)){ $query="SELECT * FROM gcbd WHERE co_name='{$_GET}' ";
6
15581
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 clause. Is this possible in a standard-conforming manner? The simple for of the query is this: SELECT * FROM <table> WHERE <column> = <value>
5
4078
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 criteria of Race, Gender and Crime Code. But the Crime Code field in the table is text, and I cannot change it. I want to use a range of crime codes, so need to convert it to an integer on-the-fly. Here's what I have in my code so far:
0
3153
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 much data for field' or the query just runs on and on til I have to restart the postmaster. I have found rules to compare mine to but people limit the resulting insert to one record (the WHERE generally limits the result of the SELECT to one...
6
4120
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 (' + @categoryID + ')' @categoryID is a string of ID's separated by comma's. ex: "1,25,78" So if @shopID = 63
9
1503
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 through the log I find the first entry where this connection has an error (there are successful queries on it prior, so it's not the first query): 2004-06-21 14:51:19 LOG: query: begin; set constraints all deferred; insert into...
7
3391
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, implemented it and was successful to make it work. Thank you Mr. Browne! However, the copy code on his web site only updates one sub-form table. My database has three sub-forms that need to be updated. Although, I am not a programmer (I am...
2
3440
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 30 seconds to return. The solution that I've devised is to create an admin function to cache all these query results and then dump that data into a new, consolidated table, and then have the users search through those new tables. Since our...
4
1362
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 that a large number of records could take a few milliseconds to write and that the time could change from 13:00:00 to 13:00:01 between the time the first record was modified and the time the last was modified. Now I've never seen that happen. But...
0
9605
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10648
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10402
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10135
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9205
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5554
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5692
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3867
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3018
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.