搞不定了,请大家看看! 创建参数一定不要使用它的向导,只会产生一堆垃圾。看一看帮助文档,建议使用sqlcommond的parameters的add方法创建参数 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 直接在程序中配置Adapter,然后Fill一个new DataSet/DataTable好啦 其实,你可以自己写DataSet的啊,如果你的存储过程在sql里运行正常的话,那么在.net下自己写吧!给你个例子:1.建立一个连接串test(在webconfig文件里,aaa是存放你存储过程的机子)<add key="test" value="server=aaa;database=test;uid=sa;pwd=" />2.创建一个类(比如叫:p_staff.cs)public DataSet staff(string xueli) { SqlDataAdapter MyAdapter= new SqlDataAdapter();SqlConnection myConnection = new SqlConnection(ConfigurationSettings.AppSettings["test"]);MyAdapter.SelectCommand = new SqlCommand("p_staff", myConnection);MyAdapter.SelectCommand.CommandType = CommandType.StoredProcedure;SqlParameter parameterxueli = new SqlParameter("@xueli", SqlDbType.VarChar, 6);parameterxueli.Value =xueli;MyAdapter.SelectCommand.Parameters.Add(parameterxueli);// Open the database connection and execute the commandDataSet ds=new DataSet();myConnection.Open();try{MyAdapter.Fill(ds);return ds;}finally{myConnection.Close();} }//end3.在.net里,建你需要的控件,这里建一个TextBox,一个Button(叫Btn_check),一个DataGrid(叫DataGrid1private void Btn_check_Click(object sender, System.EventArgs e){DataGrid1.CurrentPageIndex=0;LOVECsharp.p_staff myErp=new LOVECsharp.p_staff();DataGrid1.DataSource =myErp.staff(TextBox1.Text);DataGrid1.DataBind();}namespace为LOVECsharp,aspx文件为:p_staff.aspx你试一下,应该可以搞定的!呵呵 用存储过程就不用dataset了,直接传参数就可以了。 从存储过程中取到的 datatable,可是使用自动更新功能吗? 试题导入txt,用指定的符号分割内容!!!急急 如何获取存储过程Return 的值 ★无奈了,急盼高手解决,焦点回复问题★ C#如何不用装ACCESS就可以访问*.mdb数据库?(XP系统) 在线等,DataSet简单问题 急问关于同步进度条的问题 dataset里的资料排序 能不能让几个验证控件的错误提示信息显示在同一个地方啊? 连接northwind数据库时出现的问题! 怎样定义鼠标右击事件? 简单初级问题
给你个例子:
1.建立一个连接串test(在webconfig文件里,aaa是存放你存储过程的机子)
<add key="test" value="server=aaa;database=test;uid=sa;pwd=" />
2.创建一个类(比如叫:p_staff.cs)
public DataSet staff(string xueli)
{ SqlDataAdapter MyAdapter= new SqlDataAdapter();
SqlConnection myConnection = new SqlConnection(ConfigurationSettings.AppSettings["test"]);
MyAdapter.SelectCommand = new SqlCommand("p_staff", myConnection);
MyAdapter.SelectCommand.CommandType = CommandType.StoredProcedure;
SqlParameter parameterxueli = new SqlParameter("@xueli", SqlDbType.VarChar, 6);
parameterxueli.Value =xueli;
MyAdapter.SelectCommand.Parameters.Add(parameterxueli);
// Open the database connection and execute the command
DataSet ds=new DataSet();
myConnection.Open();
try
{
MyAdapter.Fill(ds);
return ds;
}
finally
{
myConnection.Close();
}
}//end
3.在.net里,建你需要的控件,这里建一个TextBox,一个Button(叫Btn_check),一个DataGrid(叫DataGrid1
private void Btn_check_Click(object sender, System.EventArgs e)
{
DataGrid1.CurrentPageIndex=0;
LOVECsharp.p_staff myErp=new LOVECsharp.p_staff();
DataGrid1.DataSource =myErp.staff(TextBox1.Text);
DataGrid1.DataBind();
}
namespace为LOVECsharp,aspx文件为:p_staff.aspx你试一下,应该可以搞定的!呵呵