请教:参数 0: String 类型的“@temp”,Size 属性具有无效大小值: 0
存储过程为
alter proc myproc
@temp varchar(50) output
as
select @temp=cityname from city where cityid=1 and proid=1
在调用时
con=DB.CreateConn();
cmd=new SqlCommand("myproc",con);
cmd.CommandType=CommandType.StoredProcedure;
SqlParameter sp=new SqlParameter("@temp",SqlDbType.VarChar);
sp.Direction=ParameterDirection.Output;
sp.ToString();
cmd.Parameters.Add(sp);
con.Open();
cmd.ExecuteNonQuery();
con.Close();
this.Label1.Text=cmd.Parameters["@temp"].Value.ToString();
提示参数 0: String 类型的“@temp”,Size 属性具有无效大小值: 0
是数据类型不对吗,请指教,谢谢!!