nicks60610
MIS
I have done this before when each field was a unique field from a database, but this time I have 3 columns, all named the same, but several rows of data, and I need to fill each field in my .NET page from the database, but I am not sure how to continue...
This is the code I have so far:
Dim mySelectCommand As OleDbCommand = New OleDbCommand("SELECT DISTINCT [All Plants Summary Data].Plant, [All Plants Summary Data].Group, [All Plants Summary Data].[Group Description] FROM [All Plants Summary Data] WHERE [All Plants Summary Data].Plant =? ", conMetrics)
mySelectCommand.Parameters.Add("@Plant", Plant.SelectedItem.Value)
Dim myDA As OleDbDataAdapter = New OleDbDataAdapter(mySelectCommand)
Dim myDataSet = New DataSet()
Dim myDataTable = New DataTable()
myDA.Fill(myDataSet, "[All PLants Summary Data]")
Dim Row As DataRow
If myDataSet.Tables("[All PLants Summary Data]").Rows.Count > 0 Then
Row = myDataSet.Tables("[All PLants Summary Data]").Rows(0)
End If
'GROUP DESCRIPTION FIELD 1
If Row.Item(2) Is DBNull.Value Then
GDESC1.Text = String.Empty
Else
GDESC1.Text = Row.Item(2)
End If
'GROUP ITEM 1
If Row.Item(1) Is DBNull.Value Then
G1.Text = String.Empty
Else
G1.Text = Row.Item(1)
End If
So now I want to continue with "Group Description 2" and "Group Item 2", but how do I tell it to use Row 2, Column 2 and Row 2, Column 1??
Thanks for any help on this one...
This is the code I have so far:
Dim mySelectCommand As OleDbCommand = New OleDbCommand("SELECT DISTINCT [All Plants Summary Data].Plant, [All Plants Summary Data].Group, [All Plants Summary Data].[Group Description] FROM [All Plants Summary Data] WHERE [All Plants Summary Data].Plant =? ", conMetrics)
mySelectCommand.Parameters.Add("@Plant", Plant.SelectedItem.Value)
Dim myDA As OleDbDataAdapter = New OleDbDataAdapter(mySelectCommand)
Dim myDataSet = New DataSet()
Dim myDataTable = New DataTable()
myDA.Fill(myDataSet, "[All PLants Summary Data]")
Dim Row As DataRow
If myDataSet.Tables("[All PLants Summary Data]").Rows.Count > 0 Then
Row = myDataSet.Tables("[All PLants Summary Data]").Rows(0)
End If
'GROUP DESCRIPTION FIELD 1
If Row.Item(2) Is DBNull.Value Then
GDESC1.Text = String.Empty
Else
GDESC1.Text = Row.Item(2)
End If
'GROUP ITEM 1
If Row.Item(1) Is DBNull.Value Then
G1.Text = String.Empty
Else
G1.Text = Row.Item(1)
End If
So now I want to continue with "Group Description 2" and "Group Item 2", but how do I tell it to use Row 2, Column 2 and Row 2, Column 1??
Thanks for any help on this one...