For the first part of your question you don't need the object to hold the data. You can access the row and column of the dataTable in the dataset. I normally simplify this by using a dataTable instead.
Dim dt As new DataTable
myDA.Fill(dt)
SystemNameTextBox.Text = dt.Rows(0).Item(0)
LocationNameTextBox.Text = dt.Rows(0).Item(1)
LocationIDTextBox.Text = dt.Rows(0).Item(2)
SystemIDTextBox.Text = dt.Rows(0).Item(3)
As for your second question the answer above may help.
Dim SystemID As String
SystemID = myDB.Fill(db, "blsys_systems")
Trying to allocate a filled dataSet to a string isn't correct. Just use
myDB.Fill(db, "blsys_systems")
to fill the table "blsys_systems" in the dataSet db and then access the Row(0).Item(0) to get the systemID out. You could also forego the whole dataAdapter approach and use executeScalar() function of the command object to return the string if you are only expecting one result.
hericles
Veteran Poster
1,065 posts since Nov 2007
Reputation Points: 156
Solved Threads: 228
Skill Endorsements: 9
Are you calling that code at a point before LocationComboBox.Text.ToString is set? It sounds like it is getting called when the page loads for the first time (and every page reload). What do you have in your Page_load() event?
Besides that, it sound alike the data table is empty. Can you confirm the SQL query is returning a result?
hericles
Veteran Poster
1,065 posts since Nov 2007
Reputation Points: 156
Solved Threads: 228
Skill Endorsements: 9
Question Answered as of 1 Year Ago by
hericles
and
M.Waqas Aslam