Beispiel #1
0
        public int SQLExecuteCommand(string sSql, c.DB e)
        {
            SqlConnection cnn;
            SqlCommand    cmd = new SqlCommand();
            int           i;

            LastUsedSQLStatement = sSql;

            switch (e)
            {
            case c.DB.WhosIn:
                cnn = new SqlConnection(x_sConnectionStringMain);
                break;

            case c.DB.NotUsed:
                cnn = new SqlConnection(x_sConnectionStringNOTUSED);
                break;

            default:
                cnn = new SqlConnection(x_sConnectionStringMain);
                break;
            }

            cmd.CommandText = sSql;
            cnn.Open();
            cmd.Connection = cnn;
            i = cmd.ExecuteNonQuery();
            cnn.Close();
            return(i);
        }
Beispiel #2
0
        //=========  SQL Read Datasets   ===================


        public DataSet SQLRunQuery(string sSql, c.DB e)
        {
            SqlConnection cnn;

            DataSet        ds = new DataSet();
            SqlDataAdapter sqlAdp;

            LastUsedSQLStatement = sSql;

            switch (e)
            {
            case c.DB.WhosIn:
                cnn = new SqlConnection(x_sConnectionStringMain);
                break;

            case c.DB.NotUsed:
                cnn = new SqlConnection(x_sConnectionStringNOTUSED);
                break;

            default:
                cnn = new SqlConnection(x_sConnectionStringMain);
                break;
            }
            cnn.Open();
            sqlAdp = new SqlDataAdapter(sSql, cnn);
            cnn.Close();
            sqlAdp.Fill(ds);
            return(ds);
        }