Hello. This is a rather large question, so here goes... I am looking for a way to create an online form that displays information from a database in text boxes, which would allow the user to change the data and submit it to the database as an update. I have read over the examples in 'Beginning ASP.NET Databases Using
VB.NET' and cannot find an example of what I need. Most of the examples involve displaying data from a DataSet in tables, not controls. That is, they display information in tabular form with the fields of the database occupying <td>s, not in text boxes or labels. More background on my project:
I have a SQL 2000 database that holds information on counties and agencies that handle their accounts. I want to build a form that displays those accounts and all their related fields. I have been successful in building a DataSet and populating the results of my SQL statement in a DataGrid, And I have been able to use the DataSet to loop through each row populating the form's fields into a table, like this:
Dim strCountyData As String
Dim r As DataRow
For each r in countyDataSet.Tables("dtCountyData").Rows
strCountyData &= "<td>" & r("Collectable") & "</td>"
ETC. ETC.
Next
This works when I want to write out the returned fields in HTML tables, but it really doesn't work well when I try putting those fields inside text boxes, or creating buttons to execute commands. Code such as this below does not work as the quotes interfere with the HTML produced (in this example, only the first word of the field is placed in the text box--the rest is cut off).
Dim strCountyData As String
Dim r As DataRow
For each r in countyDataSet.Tables("dtCountyData").Rows
strCountyData &= "<b>" & r("Collectable") & " for: </b>"
strCountyData &= "<input type=text value="
strCountyData &= r("EntityName")
strCountyData &= " />
ETC. ETC.
Next
To get the data into controls, do I need to set up a template then bind the data somehow to the DataSet to be run through the template? I am reading 'Professional ASP.NET 1.0' where I have seen examples using data binding to populate controls, though I cannot figure out how to do so while looping through the rows of a DataSet.
Does anyone have any suggestions?