hello.
my last problem about connecting to SQL was solved
is the code below correct for a query?
how can I access to the result of the query?Code:string conStr = "Data Source=.;Initial Catalog=WSD;Integrated Security=True"; //connection string SqlConnection conn = new SqlConnection(conStr); conn.Open(); string query = "select * from [P_E_wsd] where (english='network')"; //query DataSet ds = new DataSet(); SqlDataAdapter da = new SqlDataAdapter(); da.SelectCommand = new SqlCommand(query, conn); da.Fill(ds, "P_E_wsd") ; DataTable dt = ds.Tables[0]; conn.Close();
I know the answer should be in 'dt' but after the code is run I see non of the entry of the table in 'dt'(I check it in locals) while if I use that query command in SQL the answer will be a table with 2 rows and 4 columns.
thank you
Arian



LinkBack URL
About LinkBacks



