こんにちは私は次のように3つのテーブルを持っています
単に、学生が合格したコースのリストを取得したい(マーク> 60)。
このSQL構文を使用しました
string queryString = "select c.coursename from Courses c, RegisteredIn R where R.CourseId=c.id and R.StudentId=StudentId and R.mark > 60 ";
結果を印刷するためにこれを行いました
System.Data.SqlClient.SqlDataReader reader = command.ExecuteReader();
reader.Read();
result = string.Empty;
int counter = 1;
while (reader.Read())
{
_coursename = reader[0].ToString();
result += string.Format("{1} - Course Name : {0} </br> ",
_coursename,
counter);
counter++;
}
Response.Write(result);
reader.Close();
表示されている結果は
1 - Course Name : ADE
2 - Course Name : LMW
3 - Course Name : PBC
これは正しいですが、最初の値が欠落しているため、結果は次のようになります。
1 - Course Name : AWM
2 - Course Name : ADE
3 - Course Name : LMW
4 - Course Name : PBC
なぜ最初の結果をスキップし続けるのか理解できません
親切なアドバイス ..
ありがとうございました