I have this vb.net function:
Function CheckBillingRun(customer, type, month, year)
Dim conn = New MySqlConnection()
Dim myCommand As New MySqlCommand
Dim reader As MySqlDataReader
Dim SQL As String
Dim result As String
conn.ConnectionString = "server=" + global_variables.web_server_ip + "; user id=" + global_variables.web_server_username + "; password=" + global_variables.web_server_password + "; database=" + global_variables.web_server_database + "; "
conn.Open()
SQL = "SELECT COUNT(sequence) from billing_runs WHERE customer = '" + customer + "' AND type = '" + type + "' AND MONTH(datetime) = '" + month + "' AND YEAR(datetime) = '" + year + "' "
myCommand.Connection = conn
myCommand.CommandText = SQL
reader = myCommand.ExecuteReader
reader.Read()
result = reader.GetString(0)
conn.Close()
Return result
End Function
I am trying to call it in my application using this code:
If CheckBillingRun(reader.GetString(0), "Voice Billing", DateTime.Now.ToString("MM"), DateTime.Now.ToString("yyyy") > 0) Then
Continue While
End If
reader.getstring(0) equals 278
but i am getting an error saying:
Additional information: Conversion from string "SELECT COUNT(sequence) from bill" to type 'Double' is not valid.