Hi there,
I'm having problems retrieving data from Access database using Visual basic 2005. My database is called Actual_Database and it has a few tables. One of them is called Threshold Database. I'm trying to retrieve data from Threshold Database. In that table, it has columns of AC250L, AC250R, BC250L, BC250R, AC500L etc.. When i select a name from the combo box, and click presentButton, it will show a smile if the values from the database is more than a variable called count. I managed to retrieve only for AC columns and I couldn't retrieve BC columns. Why is that? Here's my codes..
Private Sub presentButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles presentButton.Click
Dim con As New OleDb.OleDbConnection
Dim ds As New DataSet
Dim da As New OleDb.OleDbDataAdapter
Dim sql As String
con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\Rihanna\Desktop\BIE\Actual Database.mdb;Jet OLEDB:Database Password=****"
con.Open()
sql = "SELECT * FROM ThresholdDatabase"
da = New OleDb.OleDbDataAdapter(sql, con)
da.Fill(ds, "Actual_Database")
con.Close()
s = Me.NameComboBox.SelectedIndex
'AC
left250 = ds.Tables("Actual_Database").Rows(s).Item("AC250L" )
right250 = ds.Tables("Actual_Database").Rows(s).Item("AC250R" )
left500 = ds.Tables("Actual_Database").Rows(s).Item("AC500L" )
right500 = ds.Tables("Actual_Database").Rows(s).Item("AC500R" )
'BC
leftBC250 = ds.Tables("Actual_Database").Rows(s).Item("BC250L" )
rightBC250 = ds.Tables("Actual_Database").Rows(s).Item("BC250R" )
leftBC500 = ds.Tables("Actual_Database").Rows(s).Item("BC500L" )
rightBC500 = ds.Tables("Actual_Database").Rows(s).Item("BC500R" )
If Me.acRadioButton.Checked = True Then
If count >= leftAC250 Then
Me.PictureBox1.Visible = True
tmrTimer.Interval = 1000
tmrTimer.Enabled = True
ElseIf count >= leftAC500 Then
Me.PictureBox1.Visible = True
tmrTimer.Interval = 1000
tmrTimer.Enabled = True
.
.
.
End If
End If
If Me.bcRadioButton.Checked = True Then
If count >= leftBC250 Then
Me.PictureBox1.Visible = True
tmrTimer.Interval = 1000
tmrTimer.Enabled = True
ElseIf count >= leftBC500 Then
Me.PictureBox1.Visible = True
tmrTimer.Interval = 1000
tmrTimer.Enabled = True
.
.
.
End If
End If
End Sub
Thanks =))