I want to show on Messagebox the value max and min value in my database. Help guys

        query = " SELECT Emp_ID, MIN(Log_Type) as min , MAX(Log_Type) as max FROM tbl_timelogs"
        mysql_connect(True)
        cmd = New MySqlCommand(query, SQLConnection)
        reader = cmd.ExecuteReader()

Recommended Answers

Help with what exactly?

Jump to Post

By your sql statement the reader would return two fields in one row.

min, max. Considering that Log_Type is an integer value:

 ' ...
 reader = cmd.ExecuteReader()

 Dim min, max As Integer

 ' There will only be one row.
 While (reader.Read())
     min = Convert.ToInt32(reader.GetValue(0))
     max = …
Jump to Post

All 5 Replies

Help with what exactly?

promt the min and max value of Log_type

By your sql statement the reader would return two fields in one row.

min, max. Considering that Log_Type is an integer value:

 ' ...
 reader = cmd.ExecuteReader()

 Dim min, max As Integer

 ' There will only be one row.
 While (reader.Read())
     min = Convert.ToInt32(reader.GetValue(0))
     max = Convert.ToInt32(reader.GetValue(1))
 End While

 MsgBox("Min:" & min.ToString() & " Max:" & max.ToString())

Sir see the link

Be a part of the DaniWeb community

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