I have searched for my answer only to find that there was a typo in someone's code.
I have not found why this code does not have a definition for ExecuteScalar()
. I might actually need to capture Customer_Id
when I actually add the row to the SQL database because it is auto increment.
Here is my code that had the problem:
if (customer_IDTextBox == null)
{
sqlConnection.Open();
string SQL = "SELECT MAX(Customer_ID) FROM Customer";
int maxId = Convert.ToInt32(SQL.ExecuteScalar());
sqlConnection.Close();
}