[RESOLVED] result variable of records instead of showing only query
Code:
Private Sub cmdLogin_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles cmdLogin.Click
Dim conn As MySqlConnection
conn = New MySqlConnection()
conn.ConnectionString = "server=" & txtServer.Text & ";" _
& "user id=" & txtUsername.Text & ";" _
& "password=" & txtPassword.Text & ";" _
& "database=db1"
Dim myCommand As New MySqlCommand
Dim SQL As String
SQL = "SELECT COUNT(ID) FROM OUTBOX "
Try
conn.Open()
myCommand.Connection = conn
myCommand.CommandText = SQL
myCommand.ExecuteNonQuery()
Debug.WriteLine(SQL) '<=====how to show it's result variable of records instead of showing only query
conn.Close()
Catch myerror As MySqlException
MessageBox.Show("Error Connecting to Database: " & myerror.Message)
Finally
conn.Dispose()
End Try
End Sub
i supposed it can show the result of count(ID), in this instant it is the number of records
count on the OUTBOX so the debug.writeline is RESULT, instead of now it is showing "SELECT COUNT(ID) FROM OUTBOX"
can anybody help me out this problem? thanks
Re: result variable of records instead of showing only query
Declare a variable and write
var1 = myCommand.ExecuteScalar()
now print var1.
Re: result variable of records instead of showing only query
that's it, resolved
thanks amrita, i really appreciate for your help
i will be back to rate