ids is formatted as an integer in the table "sessionregister".

How do I get ids to work either show the value or be null?


User1 = TextBox1.Text
Pass1 = Password1.Value.ToString()
Try
cmdStr = "SELECT ids FROM sessionregister WHERE username=@username AND password=@password;"
Using conn As New SqlConnection(connStr)
Using cmd As New SqlCommand(cmdStr, conn)
conn.Open()
cmd.Parameters.AddWithValue("@username", User1)
cmd.Parameters.AddWithValue("@password", Pass1)
cmd.ExecuteNonQuery()
ids = cmd.ExecuteScalar()
End Using
Error code:
Unable to cast object of type 'System.Int32' to type 'System.IDisposable'.