C#.net中执行存储过程分析

//执行存储过程和普通SQL语句的区别:
1. CommandTex = "过程名"
2.CommandType = CommandType.StoredProcedure


//下面是具体的实现方法:
SqlConnection myConnection = new SqlConnection(ConfigurationSettings.AppSettings["add"]);
SqlDataAdapter myCommand = new SqlDataAdapter("你的存储过程名",myConnection);
myConnection.Open();
myCommand.SelectCommand.CommandType =   CommandType.StoredProcedure; 
myCommand.SelectCommand.Parameters.Add("@Team_Name",System.Data.SqlDbType.VarChar,50);
myCommand.SelectCommand.Parameters["@Team_Name"].Value = Team_Name ;  //加参数
myCommand.Fill(ds,"result");
posted on 2006-07-27 13:53  欧阳  阅读(881)  评论(0编辑  收藏  举报