I have a table which contains student first name, last name, class, etc., and each student has his own "student code". I want to enter a "student code" and get back the values of the row with the specified student code.
I searched a lot and I tried to use datarow
like this question.
Here's my code:
MySqlConnection connection = new MySqlConnection();
MySqlCommand cmd = new MySqlCommand();
DataTable dt = new DataTable();
[WebMethod]
public string Student_Information(string Student_Code)
{
connection.ConnectionString = "server= ; userid= ; password= ; database= ;";
connection.Open();
string code = Student_Code;
DataRow[] drs = dt.Select("student_code='" + code + "'");
foreach (DataRow dr in drs)
{
return "True";
}
return "False";
}