代码如下
string abc = @"Data Source=MRLI\SQLEXPRESS;Initial Catalog=ly;User ID=yz;Password=yz;Pooling=False";
SqlConnection cn = new SqlConnection(abc);
SqlCommand cmd = new SqlCommand("select * from Student", cn);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds, "Student"); //这一句我下了断点然后我在即时窗口里。输入 ds.Tables[0].Rows.Count 是无法找到表。新手不知道哪里有问题。请各位大大指教。。另外祝大家新年快乐!
string abc = @"Data Source=MRLI\SQLEXPRESS;Initial Catalog=ly;User ID=yz;Password=yz;Pooling=False";
SqlConnection cn = new SqlConnection(abc);
SqlCommand cmd = new SqlCommand("select * from Student", cn);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds, "Student"); //这一句我下了断点然后我在即时窗口里。输入 ds.Tables[0].Rows.Count 是无法找到表。新手不知道哪里有问题。请各位大大指教。。另外祝大家新年快乐!
string sql = "select * from news";
conn.Open();
SqlDataAdapter sqlDataAdapter = new SqlDataAdapter(sql, conn);
DataSet ds = new DataSet();
sqlDataAdapter.Fill(ds);
conn.Close();
ds.Tables[0].Rows.Count ds.Tables["Student"].Rows.Count