예제 #1
0
    /*-----------------------------------------------------------------------------
    | Function GetDataTable: Return DataTable
    |  -----------------------------------------------------------------------------*/
    public static DataTable GetDataTable(string strSQL)
    {
        DataTable Returndt = null;
        DataTable dt       = new DataTable();

        ClassFunction_Eform.ConnectDatabase Conn = new ClassFunction_Eform.ConnectDatabase(System.Configuration.ConfigurationManager.ConnectionStrings["Myconnect"].ConnectionString);

        try
        {
            Conn.OpenDatabase();
            dt = Conn.GetData(strSQL);

            if ((dt == null))
            {
                dt = null;
            }
            else
            {
                if (dt.Rows.Count == 0)
                {
                    Returndt = null;
                }
                else
                {
                    Returndt = dt;
                }
            }
        }
        catch (Exception ex)
        {
            Conn.RollbackDatabase();
            throw ex;
        }
        finally
        {
            Conn.CloseDatabase();
        }
        return(Returndt);
    }
예제 #2
0
    /*-----------------------------------------------------------------------------
    | Function GetDataTable: Return DataTable
    |  -----------------------------------------------------------------------------*/
    public static DataTable GetDataTableSchema(string strSQL)
    {
        DataTable dt = new DataTable();

        ClassFunction_Eform.ConnectDatabase Conn = new ClassFunction_Eform.ConnectDatabase(System.Configuration.ConfigurationManager.ConnectionStrings["Myconnect"].ConnectionString);

        try
        {
            Conn.OpenDatabase();
            dt = Conn.GetData(strSQL);
        }
        catch (Exception ex)
        {
            Conn.RollbackDatabase();
            throw ex;
        }
        finally
        {
            Conn.CloseDatabase();
        }
        return(dt);
    }