您的位置:首页 > 其它

.NET调用带参数存储过程

2008-01-06 17:26 183 查看
string str = "Data Source=.;Initial Catalog=SCR_2p0_Staging;Integrated Security=True";

SqlConnection conn = new SqlConnection(str);

conn.Open();

string text = "dt_AdminTool_ServiceObjectChildList";

SqlCommand command = new SqlCommand(text, conn);

command.CommandType = CommandType.StoredProcedure;

command.Parameters.Add("parentid", SqlDbType.Int).Value = id;//parentid 输入的参数

SqlDataReader reader = command.ExecuteReader();

reader["child_id"].tostring();

reader["child_name"].tostring();//child_id和child_name都是数据库里的字段名
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: