标题:新手问题
只看楼主
chen1111
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2008-4-20
 问题点数:0 回复次数:0 
新手问题
我是新手,看不懂这几个函数的区别及他们的作用,希望哪位高手给我讲解一下,谢了
 public static SqlCommand CreatCmd(string procName, SqlParameter[] prams)
    {
        SqlConnection SqlConn = ReturnConn();
        SqlCommand Cmd = new SqlCommand();
         = CommandType.StoredProcedure;
        Cmd.Connection = SqlConn;
         = procName;
        if (prams != null)
        {
            foreach (SqlParameter paramenter in prams)
            {
                if (paramenter != null)
                {
                    Cmd.Parameters.Add(paramenter);
                }
            }
        }
        return Cmd;
 
    }
    public static SqlCommand CreatCmd(string procName, SqlConnection Conn)
    {
        SqlConnection SqlConn = Conn;
        if (SqlConn.State.Equals(ConnectionState.Closed))
        {
            SqlConn.Open();
        }
        SqlCommand Cmd = new SqlCommand();
         = CommandType.StoredProcedure;
        Cmd.Connection = SqlConn;
         = procName;
        return Cmd;
 
    }
    public static SqlCommand CreatCmd(string procName)
    {
        SqlConnection SqlConn =ReturnConn();
        SqlCommand Cmd = new SqlCommand();
         = CommandType.StoredProcedure;
        Cmd.Connection = SqlConn;
         = procName;
        return Cmd;
搜索更多相关主题的帖子: Cmd SqlCommand prams CommandType 
2008-04-20 20:57



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-210112-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.533825 second(s), 7 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved