Aan*_*Aan 14 c# sql database sqldatareader winforms
dr.Read();
如果条件满足,如何从头开始重读?就像是:
SqlDataReader dr = command.ExecuteReader();
for(int i=0; dr.Read() ; i++){
if(condition ){
//let dr.Read() start reading from the beginning
}
}
Run Code Online (Sandbox Code Playgroud)
您可以通过首先关闭 datareader 使用dr.close();
然后再次初始化它来做到这一点。
If(condition)
{
dr.close();
dr=command.ExecuteReader();
}
Run Code Online (Sandbox Code Playgroud)
其中 command 是MySqlCommand
对象。
归档时间: |
|
查看次数: |
17297 次 |
最近记录: |