473,503 Members | 1,655 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Multiple TextBoxes - Insert into SQL

Hi,

Just wanted to clairfy if there is an easier way of acheving the
following:

On my page i have ten text boxes. These boxes may or may not have data
entered into them; (This is out of choice, so the requiredfield
validator is no good)

When the user hits the submit button, I want to insert the data into my
SQL database using an Insert statement like below:
INSERT INTO RequestList
VALUES ( RegMail1.Text, RegMail2.Text, RegMail3.Text, RegMail4.Text)

Question is, what is the easiest way to get all of the text box
information into one string for the INSERT statement, whislt at the
same time removing any entries that are null? (Usually at least one or
two of the text boxes will have no information in it.

Thanks in advance
H

Aug 15 '06 #1
2 2571
If your database table will allow nulls in these columns, there's no harm in
leaving it the same and not worrying about it.

David Wier
MVP/ASPInsider
http://aspnet101.com
http://aspexpress.com
<ha****@gmail.comwrote in message
news:11*********************@74g2000cwt.googlegrou ps.com...
Hi,

Just wanted to clairfy if there is an easier way of acheving the
following:

On my page i have ten text boxes. These boxes may or may not have data
entered into them; (This is out of choice, so the requiredfield
validator is no good)

When the user hits the submit button, I want to insert the data into my
SQL database using an Insert statement like below:
INSERT INTO RequestList
VALUES ( RegMail1.Text, RegMail2.Text, RegMail3.Text, RegMail4.Text)

Question is, what is the easiest way to get all of the text box
information into one string for the INSERT statement, whislt at the
same time removing any entries that are null? (Usually at least one or
two of the text boxes will have no information in it.

Thanks in advance
H

Aug 15 '06 #2
harry,
You can just do it in sql using store procs
check if the param isnull and if it in don't insert the value.
Hope that helps
Patrick
<ha****@gmail.comwrote in message
news:11*********************@74g2000cwt.googlegrou ps.com...
Hi,

Just wanted to clairfy if there is an easier way of acheving the
following:

On my page i have ten text boxes. These boxes may or may not have data
entered into them; (This is out of choice, so the requiredfield
validator is no good)

When the user hits the submit button, I want to insert the data into my
SQL database using an Insert statement like below:
INSERT INTO RequestList
VALUES ( RegMail1.Text, RegMail2.Text, RegMail3.Text, RegMail4.Text)

Question is, what is the easiest way to get all of the text box
information into one string for the INSERT statement, whislt at the
same time removing any entries that are null? (Usually at least one or
two of the text boxes will have no information in it.

Thanks in advance
H

Aug 16 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
4059
by: Drew | last post by:
I have a db table like the following, UID, int auto-increment RegNo Person Relation YearsKnown Now here is some sample data from this table,
2
3689
by: Christopher | last post by:
Greetings, Fairly new to c# and Im looking for pointers on a few topics: Im curious as to general methods to update multiple rows in a database. Currently Im thinking of just allowing a user...
1
898
by: Teep | last post by:
Fun, fun...just when I thought it would be okay..I get something unthought of thrown in the mix. I am trying to figure out how to set this up, can someone help? I am not having a good day. I...
2
8808
by: .Net Newbie | last post by:
Hello, I am currently coding my ASP.Net pages in c# and have run into a question concerning Emails. I have four objects on a page (six including 2 buttons). The first is a subject line...
4
2906
by: Phille | last post by:
Hi I have a form with a few textboxes and some listboxes with multiple values allowed. I would like to use an append query to insert everything into a table but for some reason it just gives me no...
2
5892
by: phpachu | last post by:
Hi, I hav created a group of textboxes using a loop and its names are unique and names are assigned using variable ( like <input type=text name=$name1>). Then How can i retrieve the values in...
2
5004
by: englishman69 | last post by:
Hello, I have been banging my head against this one for a while... Searches online have revealed many different proposals for correcting my issue but none that I can follow! My basic situation...
3
11967
by: pipeme | last post by:
Hi I am using Access 2003 and I have a form with 120 textboxes in a grid layout. Depending on a selection made in a combo box, I want to change the visibility of certain textboxes in the grid. ...
3
2964
by: cubekid | last post by:
Dev't Tool: Visual C# 2003 and Javascript System Type: Web Application One requirement of the system is to dynamically create a table on client-side (Javascripting using createElement method.)...
0
7202
marktang
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,...
0
7280
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,...
0
7460
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...
0
5578
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,...
1
5014
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4672
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3154
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1512
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
380
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...

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.