当前位置: > ds.Tables[0].Rows.Count > 1...
题目
ds.Tables[0].Rows.Count > 1
private void button2_Click_1(object sender,EventArgs e)
{
DataSet ds = new DataSet();
string consqlserver = "Data Source=.;Initial Catalog=留言板;Integrated Security=SSPI";
string sql = "SELECT * FROM liuyan";
SqlConnection con = new SqlConnection(consqlserver);
SqlDataAdapter da = new SqlDataAdapter(sql,con);
try
{
da.Fill(ds);
if (ds.Tables[0].Rows.Count > 1)
{
dataGridView1.DataSource = ds.Tables[0];
}
}
catch
{
}
finally
{
con.Close();
con.Dispose();
da.Dispose();
}
}

提问时间:2020-11-02

答案
DataSet ds = new DataSet();// 创建一个内存集合,就像一个大大框一样,里面可以放很多很多的tablestring consqlserver = "Data Source=.;Initial Catalog=留言板;Integrated Security=SSPI";//字符串连接string sql ...
举一反三
已知函数f(x)=x,g(x)=alnx,a∈R.若曲线y=f(x)与曲线y=g(x)相交,且在交点处有相同的切线,求a的值和该切线方程.
我想写一篇关于奥巴马的演讲的文章,写哪一篇好呢?为什么好
奥巴马演讲不用看稿子.为什么中国领导演讲要看?
想找英语初三上学期的首字母填空练习……
英语翻译
版权所有 CopyRight © 2012-2019 超级试练试题库 All Rights Reserved.