What is the most direct route to get a DataSet if I have a sql command?
string sqlCommand = "SELECT * FROM TABLE";
string connectionString = "blahblah";
DataSet = GetDataSet(sqlCommand,connectionString);
GetDataSet()
{
//...?
}
I started with SqlConnection
and SqlCommand
, but the closest thing I see in the API is SqlCommand.ExecuteReader()
. With this method, I'll need to get a SqlDataReader
and then convert this to a DataSet
manually. I figure there is a more direct route to accomplish the task.
If easier, a DataTable
will also fit my goal.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…