前台代码:
string kssj = TextBox2.Text;
string jssj = TextBox4.Text;
SqlDataSource1.ConnectionString = "Data Source=LJ-PC\\SQLEXPRESS;Initial Catalog=StudyRoom;Integrated Security=True";
SqlDataSource1.SelectCommandType = SqlDataSourceCommandType.StoredProcedure;
SqlDataSource1.SelectCommand = "datasum_proc";
SqlDataSource1.SelectParameters.Add("@p_kssj", TypeCode.String, kssj);
SqlDataSource1.SelectParameters.Add("@p_jssj", TypeCode.String, jssj);
GridView1.DataSource = SqlDataSource1;
SqlDataSource1.DataBind();
GridView1.DataBind();数据库存储过程:
create proc datasum_proc
@p_kssj varchar(10),
@p_jssj varchar(10)asselect * from table where kssj between @p_kssj and @p_jssjreturn 0运行vs2005下该页面的时候 一直提示 未提供参数 @p_kssj
string kssj = TextBox2.Text;
string jssj = TextBox4.Text;
SqlDataSource1.ConnectionString = "Data Source=LJ-PC\\SQLEXPRESS;Initial Catalog=StudyRoom;Integrated Security=True";
SqlDataSource1.SelectCommandType = SqlDataSourceCommandType.StoredProcedure;
SqlDataSource1.SelectCommand = "datasum_proc";
SqlDataSource1.SelectParameters.Add("@p_kssj", TypeCode.String, kssj);
SqlDataSource1.SelectParameters.Add("@p_jssj", TypeCode.String, jssj);
GridView1.DataSource = SqlDataSource1;
SqlDataSource1.DataBind();
GridView1.DataBind();数据库存储过程:
create proc datasum_proc
@p_kssj varchar(10),
@p_jssj varchar(10)asselect * from table where kssj between @p_kssj and @p_jssjreturn 0运行vs2005下该页面的时候 一直提示 未提供参数 @p_kssj
解决方案 »
- 日志管理
- 更新数据时,为什么时间老更新不了。。。
- javascript调用C#后台函数时,参数怎么传?
- 据说C#是在参考JAVA等语言优缺点基础上发展而来的,其先进特性一大箩筐,但没见着几个大型项目应用典型,这CSDN又慢,还老调整老折腾......
- 请各位帮帮忙啦,急死了,老板崔交货。。。郁闷。XSL对应的XML怎样写啊。
- 怎样用字段索引获取datatable的值?
- System.Data.OracleClient 需要 Oracle 客户端软件 8.1.7 或更高版本。
- 请一个Repeater分页的完美解决方案
- asp.net中怎样打开文件对话框啊?
- .net操作Exchange的问题
- 我得到了一个josn格式字符串,想要分析它并得到想要的值要怎么做
- 清空HTML标签的问题。。。救命啊
SqlDataSource1.DataBind();
GridView1.DataSource = SqlDataSource1;换下顺序或者
SqlConnection connection = new SqlConnection("Data Source=LJ-PC\\SQLEXPRESS;Initial Catalog=StudyRoom;Integrated Security=True");
connection.Open();
SqlCommand command = new SqlCommand("datasum_proc", connection);
command.CommandType = CommandType.StoredProcedure;
command.Parameters.AddWithValue("@p_kssj", kssj);
command.Parameters.AddWithValue("@p_jssj", jssj);
SqlDataReader reader = command.ExecuteReader();
GridView1.DataSource = reader ;
GridView1.DataBind();