Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I would suggest using the built in grid controls. Here is a walkthrough <a href="http://msdn.microsoft.com/en-us/library/sdba1d59.aspx" rel="nofollow noreferrer">Walkthrough: Editing and Inserting Data in Web Pages with the DetailsView Web Server Control</a> . It might be better to start with <a href="http://msdn.microsoft.com/en-us/library/tw738475.aspx" rel="nofollow noreferrer">Walkthrough: Basic Data Access in Web Pages</a>.</p> <p>If you choose to move forward with HTML then here is one way to do it based on what you provided. You can add an update button and try this code in that event:</p> <pre><code>'Create an update Command with the apropriate paramaters' Dim sql = ("UPDATE SO_Prices SET Price = @Price WHERE ID = @ID") Dim Cmd As New SqlCommand(sql, connection) Cmd.Parameters.Add("@Price", SqlDbType.SmallMoney) Cmd.Parameters.Add("@ID", SqlDbType.Int) connection.Open() 'Loop through the fields returned' For Each Key As String In Request.Form.Keys 'Make sure you only process fields you want' If Key.StartsWith("price") Then 'Pull the ID out of the field name by splitting on the underscore' ' then choosing the second item in the array' Dim ID As String = Key.Split("_")(1) 'Update the paramaters for the update query' Cmd.Parameters("@ID").Value = ID Cmd.Parameters("@Price").Value = Request.Form(Key) 'Run the SQL to update the record' Cmd.ExecuteNonQuery() End If Next connection.Close() </code></pre> <p>Let me know if you need any additional assitance. If not, please mark this as the correct answer.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload