名字为 a 带传入参数的存储过程
里面 exec(select * from user where name=@name )
请问 程序里如何调用?
------解决方案--------------------------------------------------------
- C# code
SqlCommand cmd = new SqlCommand(); cmd.Connection = conn;//数据库连接 cmd.CommandText = "exec a"; CommandType.StoredProcedure cmd.CommandType =// type; SqlDataAdapter da = new SqlDataAdapter(cmd); da.Fill("table1");
------解决方案--------------------------------------------------------
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandType=CommandType.StoreProcedure
cmd.CommandText =存储过程名
cmd.execureScalar();
------解决方案--------------------------------------------------------