Esempio n. 1
0
        // :::::::::::: Use this method to Execute a query string ::::::::::::
        public void ExecuteCommand(string MyQuery)
        {
            con = dbCon.dbConnect();
            con.Open();
            SqlCommand sqlComm = new SqlCommand(MyQuery, con);

            sqlComm.ExecuteNonQuery();
            con.Close();
        }
Esempio n. 2
0
        // :::::::::::: Use this method to execute query by DataReader ::::::::::::
        public SqlDataReader getDataReader(string MyQuery)
        {
            SqlConnection con   = new SqlConnection();
            dbConnection  dbCon = new dbConnection();

            con = dbCon.dbConnect();
            con.Open();
            SqlCommand cmd = new SqlCommand(MyQuery, con);

            return(cmd.ExecuteReader());
        }
Esempio n. 3
0
        // :::::::::::: Use this method to return a DataSet from query string ::::::::::::
        public DataSet getDataSet(string MyQuery, string MyString)
        {
            SqlConnection  con   = new SqlConnection();
            dbConnection   dbCon = new dbConnection();
            SqlDataAdapter daGen;
            DataSet        dsGen;

            dsGen = new DataSet();
            con   = dbCon.dbConnect();
            daGen = new SqlDataAdapter(MyQuery, con);
            daGen.Fill(dsGen, MyString);

            return(dsGen);
        }
Esempio n. 4
0
        public static DataTable getResultStringConvert(string MyQuery)
        {
            DataTable dt = new DataTable();

            SqlConnection  con1   = new SqlConnection();
            dbConnection   dbCon1 = new dbConnection();
            SqlDataAdapter daGen1;
            DataSet        dsGen1;

            dsGen1 = new DataSet();
            con1   = dbCon1.dbConnect();
            daGen1 = new SqlDataAdapter(MyQuery, con1);
            daGen1.Fill(dsGen1);
            dt = dsGen1.Tables[0];

            return(dt);
        }
Esempio n. 5
0
        // :::::::::::: Use this method to return a DataTable from query string ::::::::::::
        public DataTable getDataTable(string MyQuery, string MyTable)
        {
            DataTable dt = new DataTable();

            SqlConnection  con1   = new SqlConnection();
            dbConnection   dbCon1 = new dbConnection();
            SqlDataAdapter daGen1;
            DataSet        dsGen1;

            dsGen1 = new DataSet();
            con1   = dbCon1.dbConnect();
            daGen1 = new SqlDataAdapter(MyQuery, con1);
            daGen1.Fill(dsGen1, MyTable);
            dt = dsGen1.Tables[MyTable];
            dsGen1.Tables.Remove(MyTable);

            return(dt);
        }