Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 15714

SELECT COUNT (*) does not return 0

$
0
0
Code:

cnn.ConnectionString = "server=ipaddress;userid=user;password=pass;database=aml;"

Dim numrows As Integer = 0

cnn.Open()
Dim Query2 As String = "select count(*) from aml.mlog where Mlogpageno='" & ComboBox1.Text & "'"
COMMAND = New MySql.Data.MySqlClient.MySqlCommand(Query2, cnn)
numrows = CInt(COMMAND.ExecuteScalar())
cnn.Close()
TextBox1.Text = numrows.ToString

If numrows = 0 Then
    MessageBox.Show("Missing Logpage. Please Include the Bundle and Generate Logpage.")
    ComboBox1.Focus()
    Exit Sub
End If

The problem is numrows does not returns 0 when no matching found . Retuns 1 when ComboBox1 value match 1.

Viewing all articles
Browse latest Browse all 15714

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>