How about assigning the return value from ExecuteScalar() to a temp variable of type Object, and then looking under a debugger to see what is being returned?
In other words:
object val = cmd_id.ExecuteScalar();
_id = (int)val; // Set a breakpoint here, and examine the contents of val
Maybe you're getting back a DbNull value, indicating that your query didn't execute properly. Or perhaps the value that is being returned by
isn't of type