I have entered a user's name that exists in the DB. The name has only first and last name. so the middle name is empty and it is stored in the DB as null. To get the employee id of the user, i have used the following query. but the value of obj after executing the query is null. The first and last names are stored in an array. I have checked their values. Their values are ok.
Can you please tell me why the object is not fetching nay value.
SqlCommand cmm1= new SqlCommand ();
cmm1.CommandText = ("Select empID from empPersonalInfo where empFirstName= '" + arr[0].ToString() + "' and empMiddleName= '" + System.DBNull.Value + "' and empLastName= '" + arr[2].ToString() + "' ");
cmm1.Connection = conn;
obj = cmm1.ExecuteScalar();