archer_coal
Well-known member
- Joined
- Apr 4, 2003
- Messages
- 96
I have a bunch of labels on my form that i would like to populate with the first row of my database table.
Im running into problems with DBNull values or No value errors
i have a function that determines what label to use and it works fine, but getting the right data with no errors is makin me nuts.
this is a really rough code to see if what i want is even possible so forgive the crudeness
A reader here may not be the solution. But i have no idea how else to loop through all the fields of the "row".
Notice the select statement grabs the row i need already. Static Binding is out too.
Im running into problems with DBNull values or No value errors
i have a function that determines what label to use and it works fine, but getting the right data with no errors is makin me nuts.
this is a really rough code to see if what i want is even possible so forgive the crudeness
Code:
Dim mySelectQuery As String = "SELECT * FROM " & var_month & " Where id = 1"
Dim myConnection As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\data\20304aa1.mdb")
Dim myCommand As New OleDbCommand(mySelectQuery, myConnection)
myConnection.Open()
Dim myReader As OleDbDataReader
myReader = myCommand.ExecuteReader()
Dim first As Integer
Dim i, ds As Integer
Do While myReader.Read
first = myReader("first")
Loop
For i = 0 To 30
lblday_value = myReader(1)
get_label(first).Text = lblday_value
first = (first + 1)
Next
Notice the select statement grabs the row i need already. Static Binding is out too.