473,651 Members | 3,011 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 2582
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.c omwrote in message
news:11******** *************@7 4g2000cwt.googl egroups.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.c omwrote in message
news:11******** *************@7 4g2000cwt.googl egroups.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
4071
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
3707
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 to update one row of data at a time and designing/building textboxes to allow them to enter this data. I would then use a method to insert this data. (sqlCommand) Is there a more efficient method of updating 10 rows of data at a time? Such
1
901
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 have four text boxes for a user to enter data that will be sent to a sql table, now I have to figure out how to give the user an option of having a grid with those four boxes displayed fifteen times. For example...an account number can be assigned to...
2
8824
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 (textbox) , the next is the email body (a Textbox with multiple rows), an email address (textbox), and a DropDownList containing multiple email addresses (populated from a SQL Server table). The way this page functions is that a user types in the email...
4
2913
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 values at all for the listboxes (the textboxes are ok). Is there something that could be done. Thanks in advance
2
5909
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 that textboxes after a button click with in a loop. Really I cant move from here. Can anyone plz help me.. Part of the my code is given below <html> <table> <?php // i hav an array "assocArray" and its count is "countarray" for($i = 1; $i <...
2
5019
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 is this, I have a page which uses multiple postbacks to generate a list of dynamic text boxes with appropriate labels. However, when I do the final postback to enter the values in the dynamic textboxes into the database the values seem to become...
3
11986
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. This is easy enough to do as a one-by-one basis but due to the number of textboxes I need to change I am wondering if there is a way I can make it hide a group of these boxes all at once? For example, I group textboxes 1-11 and 30-40 as GroupA and...
3
2975
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.) The table has textboxes inside each cell. a few sample code: for (i = 0; i < 4; i ++) // four columns { textBoxes = document.createElement("INPUT");
0
8278
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
8807
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...
0
8701
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8466
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
8584
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
4290
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2701
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 we have to send another system
1
1912
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1588
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.