K
K Viltersten
I run the following code, which works well and gives
me the expected results.
string cmdStr = "select Stuff from There";
SqlCommand cmd = new SqlCommand(cmdStr, _sqlCon);
_sqlCon.Open();
int res = cmd.ExecuteNonQuery();
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
this._sqlCon.Close();
However, i can't stop wondering - am i, perhaps,
executing the command cmd twice? Once using
ExecuteNonQuery() and the again using Fill(ds)?
If so, i'd like to skip the first one BUT then i
can't see how to obtain the response res from
the database. I've checked the members of da
but i haven't found anything useful.
me the expected results.
string cmdStr = "select Stuff from There";
SqlCommand cmd = new SqlCommand(cmdStr, _sqlCon);
_sqlCon.Open();
int res = cmd.ExecuteNonQuery();
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
this._sqlCon.Close();
However, i can't stop wondering - am i, perhaps,
executing the command cmd twice? Once using
ExecuteNonQuery() and the again using Fill(ds)?
If so, i'd like to skip the first one BUT then i
can't see how to obtain the response res from
the database. I've checked the members of da
but i haven't found anything useful.