Groups | Blog | Home
all groups > vb.net data > may 2006 >

vb.net data : Create SQL Statement with Form with many textboxes


MATT
5/3/2006 3:25:02 PM
I have a form with about 50 textboxes that the user inputs information. When
you click "Submit", it inserts the record into a SQL Database. Could someone
recomend a better way of generating the sql statment. Right now i have:

"Insert into Table (field1, field2, field3.... field50) values
(form.txtbox1.text, form.txtbox2.text,
form.txtbox3.text.....form.textbox50.text)"

Obviously this makes for a very long sql statement that is not easy to workk
with. I thought of a for/next statement (for each control in Form, if
control = textbox... etc) and have the SQL column name as the TAG property of
the textbox. Any Suggestions?
Thanks
LinasB
5/4/2006 12:00:00 AM
I have done this, but my data table have other structure:

parameter, data.
parameter1, data1
parameter2, data2
........

then it's easy to make insert or update with For Each Control in Controls.

[quoted text, click to view]

AddThis Social Bookmark Button