我正在尝试使用SqlDataReader来提取数据,其中一列是在datetime中.我想做这样的事情
SqlCommand command = new SqlCommand("SELECT * FROM table", connection); //connection is defined earlier
SqlDataReader data = command.ExecuteReader();
while(data.Read()){
DateTime birthday = data["Birth"];
list.Add(birthday);
}
}
Run Code Online (Sandbox Code Playgroud)
我可以这样做吗?或者SqlDataReader是否返回字符串,在这种情况下,我必须使用该字符串创建一个新的DateTime对象?
谢谢,-S
| 归档时间: |
|
| 查看次数: |
445 次 |
| 最近记录: |