使用存储过程碰到的问题
zj558 2004-04-25 12:46:59 我在做存储过程时遇到问题:
ALTER PROCEDURE [select]
(@xh char)
/*
(
@parameter1 datatype = default value,
@parameter2 datatype OUTPUT
)
*/
AS
select * from cjb where xh=@xh
/* SET NOCOUNT ON */
RETURN
cunchu.aspx.cs代码:
string strConn="server=localhost;uid=sa;pwd=;database=stu";
SqlConnection cn=new SqlConnection(strConn);
SqlDataAdapter myCommand = new SqlDataAdapter("select",cn);
DataSet ds = new DataSet();
myCommand.SelectCommand.CommandType=CommandType.StoredProcedure;
myCommand.SelectCommand.Parameters.Add(new SqlParameter("@xh", SqlDbType.Char,18));
myCommand.SelectCommand.Parameters["@xh"].Value = "001";
myCommand.Fill(ds, "user1");
MyDataGrid.DataSource=ds.Tables["user1"].DefaultView;
MyDataGrid.DataBind();
为什么运行时没有001的记录出现呢?