Well, as a beginner, you can try the code below which fetches some data into a dataset.
string strCon = @"Data Source=yourservername;" +
"Initial Catalog=Northwind;Integrated Security=SSPI";
string strSql="select * from customers";
SqlConnection con=new SqlConnection(strCon);
con.Open();
SqlDataAdapter dadapter=new SqlDataAdapter();
dadapter.SelectCommand=new SqlCommand(strSql,con);
DataSet dset=new DataSet();
dadapter.Fill(dset);
con.Close();
Regards
Mike
|