Hi, I am trying to get the value from a field in my Access DB.Once the value is retrieved I need to be able to compare it to a condition I set. I still haven't figured out the right code to make this happen....i don't know if I should convert something or what,
heres my line of code...

ElseIf Me.AssociateDBDataSet.Associates.Rows(0).Item(4).value.ToString = ("No") Then
            MsgBox("You are not currently scheduled for Training! Please see your Trainer.", MessageBoxIcon.Stop)

        End If

Thanks for any help :)

Recommended Answers

All 2 Replies

You can do the same thing using a DataReader object.
Simply state the criteria in a SQL query and count the rows.
This is just a suggestion....

Dim con As New OleDbConnection("<onnection string>")
con.Open()
Dim com As New OleDbCommand("SELECT COUNT(*) FROM <table> WHERE <column4> = 'No' AND <some other criterias to limit the result>", con)
If Cint(com.ExecuteScalar()) > 0 Then
   MsgBox("You are not currently scheduled for Training! Please see your Trainer.", MessageBoxIcon.Stop)
End If
con.Close()

Dim con as OleDbConnection
Dim cmd as OleDbCommand
dim sql as String

con = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\Documents and Settings\\Zenith\\My Documents\\dew.mdb");
con.Open()
String sql = "Select Class_Name From Class "
OleDbCommand cmd = new OleDbCommand("Select * from dew",con);
rdr = cmd.ExecuteReader()
While (rdr.Read())
msgbox(rdr.GetString(0)
textbox1.text= rdr.GetString(0)
End While

con.Close()

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.