SqlDataAdapter sda = new SqlDataAdapter(); //DataSet
//查询调用存储过程 需要先准备一个命令对象
SqlCommand cmd=new SqlCommand("PR_selectNew",conn);
cmd.CommandType = CommandType.StoredProcedure;
//设置适配器SqlDataAdapter 将准备号的命令对象 放入适配器中执行
sda.SelectCommand = cmd;
DataSet ds = new DataSet();
//填充
sda.Fill(ds);
GridView1.DataSource = ds;
GridView1.DataBind();
//操作
SqlCommand cmd = new SqlCommand("PR_insertLogs",conn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add(new SqlParameter("@Tittle", SqlDbType.NVarChar, 100));
cmd.Parameters.Add(new SqlParameter("@CreateTime", SqlDbType.DateTime)).Value = time;
cmd.Parameters.Add(new SqlParameter("@Number", SqlDbType.Int)).Value = 0;
cmd.Parameters[0].Value=Tittles.Text.Trim();