示例#1
0
        public DbConnection getConnection()
        {
            DbConnection c = new TAdoDbxInterBaseConnection();

            c.ConnectionString = "Database=192.168.1.250:\\datos\\2007.gdb;User_Name=sysdba;Password=masterkey";
            return(c);
        }
        public static DataSet ExecuteDatasetTEST(string strConnection, string commandText)
        {
            if (strConnection == null) throw new ArgumentNullException("connection");

            // Create a command and prepare it for execution
            DbConnection conn = new TAdoDbxInterBaseConnection();
            conn.ConnectionString = strConnection;

            DataSet dsReturnin = new DataSet();
            DataTable dt = new DataTable();
            string sql = commandText;
          

                DbCommand cmd = conn.CreateCommand();
                cmd.CommandText = sql;
                conn.Open();

                DbDataReader myreader = cmd.ExecuteReader();
                dsReturnin.Tables.Add(dt);
                dsReturnin.Load(myreader, LoadOption.PreserveChanges, dsReturnin.Tables[0]);
                myreader.Close();
                conn.Close();
                conn.Dispose();
         

            return dsReturnin;
        }
        public static DataSet ExecuteDataset_UPDT_COMMD(string strConnection, string commandText)
        {
            if (strConnection == null) throw new ArgumentNullException("connection");

            // Create a command and prepare it for execution
            DbConnection conn = new TAdoDbxInterBaseConnection();
            conn.ConnectionString = strConnection;

            DataSet dsReturnin = new DataSet();
            DataTable dt = new DataTable();
            string sql = commandText;
          

                DbCommand cmd = conn.CreateCommand();
                cmd.CommandText = sql;
                conn.Open();


                DbDataAdapter adapter = new TAdoDbxDataAdapter();
                
                adapter.UpdateCommand = cmd;


                //BdpCommand CommIns = new BdpCommand("INSERT INTO TESTTABLE VALUES(?)", Conn);
                //BdpDataAdapter adapter
                //adapter.InsertCommand = CommIns; 
         

            return dsReturnin;
        }