示例#1
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="dbVistor"></param>
 /// <param name="sqlCommand"></param>
 /// <param name="param"></param>
 /// <returns></returns>
 public string FirstRow(DataBaseVisitor dbVistor, string sqlCommand, SqlParameter[] param)
 {
     DataBase DB = new DataBase();
     if (false == DB.Open())
         DB.Open();
     SqlCommand cmd = new SqlCommand(dbVistor.ExecSql(sqlCommand), DB.m_sqlCon);
     if (param != null)
     {
         foreach (SqlParameter parameter in param)
             cmd.Parameters.Add(parameter);
     }
     try
     {
         string DeptName = cmd.ExecuteScalar().ToString();
         return DeptName;
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
         return null;
     }
 }