Assign query result to a variable and return variable – Asp.net
private int getuserid(String username){ SqlConnection con = new SqlConnection(_conString); SqlCommand cmd = new SqlCommand(); cmd.CommandType = CommandType.Text; cmd.CommandText = "SELECT USER_ID from tblUser where USERNAME ='" +username+"'"; int locid = Convert.ToInt32(cmd.CommandText); return locid; } Hi everyone, do you have an…