myConnect.open();
string myStringCommand = "SELECT ordinal, codeOfStu, fullName, ST.codeOfClass, CL.nameOfClass FROM Student ST, Class CL WHERE ST.codeOfClass = CL.codeOfClass AND ST.codeOfClass = @SelectedCodeOfClass";
OleDbCommand command = new OleDbCommand(myStringCommand, myConnect);
OleDbParameter myParameter = new OleDbParameter("@SelectedCodeOfClass", OleDbType.Integer);
myParameter.Value = SelectedCodeOfClass; // SelectedCodeOfClass is a parameter which is carried from main function.
myCommand.Parameters.Add(myParameter);
OleDbDataReader myReader = myCommand.ExecuteReader();
.
.
.
Now, I want not use "connect model" to access database anymore. I want use "disconnect model" to do that.
If I do like this:
OleDbDataAdapter adap=new OleDbDataAdapter("select * from tablename",con);
Dataset ds=new Dataset();
adap.fill(ds);
The Thing I receive is a datatable involve in all of the students. I don't want read all of the Student 's Information in database. I only want read students' Information according to class (codeOfClass) that they belong to