0

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 :)

3
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by dew97
0

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()
0

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()

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.