zoukankan      html  css  js  c++  java
  • 使用企业库调用存储过程(带参数)完成数据获取样例

            /// <summary>
            /// 根据岗位获取有意向人员
            /// </summary>
            /// <param name="job"></param>
            /// <returns></returns>
            public string GetJobUser(string job)
            {
                string userList = "";
                try
                {

                 //存储过程名    
                    string strSQL = "Job_GetUserList";
                    //参数
                    DbCommand cmd = db.GetStoredProcCommand(strSQL);
                    db.AddInParameter(cmd, "@Job", DbType.String, job);
                    DataTable dt = db.ExecuteDataSet(cmd).Tables[0];

                    userList = dt.Rows.Count.ToString() + "位有该岗位意向,具体如下:";

                    foreach (DataRow dr in dt.Rows)
                    {
                        userList += dr["姓名"]+",";
                    }
                    return userList;

                }
                catch (Exception ex)
                {

                    return null;
                }


                return userList;
            }

  • 相关阅读:
    拷贝构造函数与赋值函数的区别
    C++模板(一)
    拷贝构造函数
    memcpy函数
    malloc calloc 和 realloc
    extern关键字
    C中不安全函数
    缓冲区溢出问题
    C++引用
    背包问题专栏(01,完全,多重)
  • 原文地址:https://www.cnblogs.com/itbob/p/1743469.html
Copyright © 2011-2022 走看看