P
P
Panicrust2014-05-21 17:31:19
SQL
Panicrust, 2014-05-21 17:31:19

How to get values ​​of all textbox in asp page and write them to sql?

There is a form from a bunch of TextBoxes that looks something like this:

<tr>
        <td><label>Название </label></td>
        <td><label>Параметр 1 </label></td>
        <td><asp:textBox ID="tb650a" runat="server" Text=""/></td>
<tr>

There are still 200 such pieces, with different IDs. Each ID corresponds to a column in SQL. The data from the TextBoxes is passed to the SQL query.
I would like to automate and not write "Chinese code" like
string query = "INSERT INTO [table](field1, field2, field3, bla-bla-bla... ) VALUES(N'" + field1.Text + "', N'" + field2.Text + "', N'" + field3.Text + "', N'" + bla-bla-bla...")";

and enumeration of TextBox values ​​in foreach , for example

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question