当前位置: 首页>>代码示例>>C#>>正文


C# FbDataAdapter.Dispose方法代码示例

本文整理汇总了C#中FirebirdSql.Data.FirebirdClient.FbDataAdapter.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# FbDataAdapter.Dispose方法的具体用法?C# FbDataAdapter.Dispose怎么用?C# FbDataAdapter.Dispose使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FirebirdSql.Data.FirebirdClient.FbDataAdapter的用法示例。


在下文中一共展示了FbDataAdapter.Dispose方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DeleteTest

        public void DeleteTest()
        {
            string sql = "select * from TEST where int_field = @int_field";
            FbTransaction transaction = this.Connection.BeginTransaction();
            FbCommand command = new FbCommand(sql, Connection, transaction);
            FbDataAdapter adapter = new FbDataAdapter(command);
            adapter.MissingSchemaAction = MissingSchemaAction.AddWithKey;

            adapter.SelectCommand.Parameters.Add("@int_field", FbDbType.Integer).Value = 10;

            FbCommandBuilder builder = new FbCommandBuilder(adapter);

            DataSet ds = new DataSet();
            adapter.Fill(ds, "TEST");

            Assert.AreEqual(1, ds.Tables["TEST"].Rows.Count, "Incorrect row count");

            ds.Tables["TEST"].Rows[0].Delete();

            adapter.Update(ds, "TEST");

            adapter.Dispose();
            builder.Dispose();
            command.Dispose();
            transaction.Commit();
        }
开发者ID:kingpong,项目名称:NETProvider,代码行数:26,代码来源:FbDataAdapterTests.cs

示例2: PesquisaGridView

        public DataTable PesquisaGridView(string sCampos, string sWhere)
        {
            try
            {
                DataTable dt = new DataTable();
                string sQuery = "Select "
                                + sCampos
                                + " from conhecim c inner join remetent r on c.cd_remetent = r.cd_remetent"
                                + " Where " + sWhere;

                FbDataAdapter da = new FbDataAdapter(sQuery, cx.get_Conexao());
                dt.Clear();
                cx.Open_Conexao();
                da.Fill(dt);
                da.Dispose();
                return dt;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                cx.Close_Conexao();
            }
        }
开发者ID:dramosti,项目名称:GeraXml_2.0,代码行数:26,代码来源:daoBuscaDadosGeais.cs

示例3: BuscaDadosNF

        public DataTable BuscaDadosNF()
        {
            DataTable dt = new DataTable();
            try
            {
                sSQL = "SELECT " + this.sCampos + " FROM " + this.sTabela;
                if (!(this.sInner.Equals(String.Empty)))
                    sSQL += this.sInner.ToString();

                if (!(this.sWhere.Equals(String.Empty)))
                    sSQL += " WHERE " + this.sWhere + " ";

                if (!(this.sOrder.Equals(String.Empty)))
                    sSQL += " ORDER BY " + this.sOrder;
                FbDataAdapter Da = new FbDataAdapter(sSQL, cx.get_Conexao());
                cx.Open_Conexao();
                dt.Clear();
                Da.Fill(dt);
                Da.Dispose();
            }
            catch (Exception)
            {
                throw;
            }
            finally { cx.Close_Conexao(); }
            return dt;
        }
开发者ID:dramosti,项目名称:GeraXml_2.0,代码行数:27,代码来源:belGerarXML.cs

示例4: PesquisaGridViewContingencia

        public DataTable PesquisaGridViewContingencia(string sCampos)
        {
            try
            {
                DataTable dt = new DataTable();
                string sQuery = "Select "
                                + sCampos
                                + " from conhecim c inner join remetent r on c.cd_remetent = r.cd_remetent"
                                + " where conhecim.st_contingencia ='S'  and (conhecim.st_cte='N' or  conhecim.st_cte is null)";

                FbDataAdapter da = new FbDataAdapter(sQuery, cx.get_Conexao());
                dt.Clear();
                cx.Open_Conexao();
                da.Fill(dt);
                da.Dispose();

                return dt;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                cx.Close_Conexao();
            }
        }
开发者ID:dramosti,项目名称:GeraXml_2.0,代码行数:27,代码来源:daoBuscaDadosGeais.cs

示例5: fnSearchBank

        public DataTable fnSearchBank()
        {

            // Initializate
            cm = new FbCommand();
            dt = new DataTable();

            // Command attributes
            cm.CommandType = CommandType.StoredProcedure;
            cm.CommandText = "spBank_SEL_ALL";
            cm.Connection = (FbConnection)objBankBE.oConnection;

            // Stored Procedure Atributtes
            if (ObjBankBE.nBank == 0)
            {
                cm.Parameters.AddWithValue("@sCommand", DBNull.Value);
            }

            else
            {
                cm.Parameters.Add("@sCommand", FbDbType.Char).Value = objBankBE.sSearchCommand;
            }

            try
            {

                // Execute
                da = new FbDataAdapter(cm);
                da.Fill(dt);
                da.Dispose();

                return dt;

            }

            finally
            {

                cm.Dispose();
                dt.Dispose();

            }

        }
开发者ID:danielaemtranse,项目名称:Studio-Money,代码行数:44,代码来源:BankSQL.cs

示例6: fnGetFields

        public DataTable fnGetFields()
        {

            // Initializate
            cm = new FbCommand();
            dt = new DataTable();

            // Command attributes
            cm.CommandType = CommandType.StoredProcedure;
            cm.CommandText = "spFields_SEL";
            cm.Connection = (FbConnection)objMainBE.oConnection;

            // Stored Procedure Atributtes
            if (ObjMainBE.sItem == "")
            {
                cm.Parameters.AddWithValue("@w_sItem", DBNull.Value);
            }

            else
            {
                cm.Parameters.Add("@w_sItem", ObjMainBE.sItem);
            }

            try
            {

                // Execute
                da = new FbDataAdapter(cm);
                da.Fill(dt);
                da.Dispose();

                return dt;

            }

            finally
            {

                cm.Dispose();
                dt.Dispose();

            }

        }
开发者ID:danielaemtranse,项目名称:Studio-Money,代码行数:44,代码来源:MainSQL.cs

示例7: FillTest

		public void FillTest()
		{
			FbTransaction transaction = this.Connection.BeginTransaction();
			FbCommand command = new FbCommand("select * from TEST", Connection, transaction);
			FbDataAdapter adapter = new FbDataAdapter(command);
            adapter.MissingSchemaAction = MissingSchemaAction.AddWithKey;

			FbCommandBuilder builder = new FbCommandBuilder(adapter);

			DataSet ds = new DataSet();
			adapter.Fill(ds, "TEST");

			Assert.AreEqual(100, ds.Tables["TEST"].Rows.Count, "Incorrect row count");

			Console.WriteLine();
			Console.WriteLine("DataAdapter - Fill Method - Test");

			foreach (DataTable table in ds.Tables)
			{
				foreach (DataColumn col in table.Columns)
				{
					Console.Write(col.ColumnName + "\t\t");
				}

				Console.WriteLine();

				foreach (DataRow row in table.Rows)
				{
					for (int i = 0; i < table.Columns.Count; i++)
					{
						Console.Write(row[i] + "\t\t");
					}

					Console.WriteLine("");
				}
			}

			adapter.Dispose();
			builder.Dispose();
			command.Dispose();
			transaction.Commit();
		}
开发者ID:masroore,项目名称:Firebird-NETProvider,代码行数:42,代码来源:FbDataAdapterTests.cs

示例8: DataAdapterFillTest

		public void DataAdapterFillTest()
		{
			FbCommand command = new FbCommand("select * from TEST where DATE_FIELD = ?", Connection);
			FbDataAdapter adapter = new FbDataAdapter(command);

			adapter.SelectCommand.Parameters.Add("@DATE_FIELD", FbDbType.Date, 4, "DATE_FIELD").Value = new DateTime(2003, 1, 5);

			FbCommandBuilder builder = new FbCommandBuilder(adapter);

			DataSet ds = new DataSet();
			adapter.Fill(ds, "TEST");

			Console.WriteLine();
			Console.WriteLine("Implicit transactions - DataAdapter Fill Method - Test");

			foreach (DataTable table in ds.Tables)
			{
				foreach (DataColumn col in table.Columns)
				{
					Console.Write(col.ColumnName + "\t\t");
				}

				Console.WriteLine();

				foreach (DataRow row in table.Rows)
				{
					for (int i = 0; i < table.Columns.Count; i++)
					{
						Console.Write(row[i] + "\t\t");
					}

					Console.WriteLine("");
				}
			}

			adapter.Dispose();
			builder.Dispose();
			command.Dispose();
		}
开发者ID:Outlivier,项目名称:FirebirdSql.Data.FirebirdClient,代码行数:39,代码来源:FbImplicitTransactionTests.cs

示例9: GetSchema

		public DataTable GetSchema(FbConnection connection, string collectionName, string[] restrictions)
		{
			DataTable dataTable = new DataTable(collectionName);
			FbCommand command = this.BuildCommand(connection, collectionName, this.ParseRestrictions(restrictions));
			FbDataAdapter adapter = new FbDataAdapter(command);

			try
			{
				adapter.Fill(dataTable);
			}
			catch (Exception ex)
			{
				throw new FbException(ex.Message);
			}
			finally
			{
				adapter.Dispose();
				command.Dispose();
			}

			TrimStringFields(dataTable);

			return this.ProcessResult(dataTable);
		}
开发者ID:cafee,项目名称:NETProvider,代码行数:24,代码来源:FbSchema.cs

示例10: BuscaDadosNF

        public DataTable BuscaDadosNF()
        {
            Conn.Open();

            sSQL = "SELECT " + this.sCampos + " FROM " + this.sTabela;

            if (!(this.sInner.Equals(String.Empty)))
                sSQL += this.sInner.ToString();

            if (!(this.sWhere.Equals(String.Empty)))
                sSQL += " WHERE " + this.sWhere + " ";

            if (!(this.sOrder.Equals(String.Empty)))
                sSQL += " ORDER BY " + this.sOrder;

            /*
            SelCmd = new FbCommand(sSQL, Conn);
            ,SelCmd.CommandType = CommandType.Text;
             */

            DataTable dt = new DataTable();

            FbDataAdapter Da = new FbDataAdapter(sSQL, Conn);

            dt.Clear();
            Da.Fill(dt);
            Da.Dispose();

            Conn.Close();

            return dt;
        }
开发者ID:dramosti,项目名称:GeraXml_2.0,代码行数:32,代码来源:belGerarxml.cs

示例11: ExecuteQuery

        /// ------------------------------------------------------------------------------------------------------------------------
        /// <summary>
        /// Führt das übegenen SQL Kommando aus
        /// </summary>
        /// <param name="sql">SQL Befehl der ausgeführt werden soll</param>
        /// <returns>Die Ergebnismenge des Befehls</returns>
        public static DataTable ExecuteQuery(string sql)
        {
            DataTable dt = new DataTable();

            FbTransaction fbTransaction = fbConnection.BeginTransaction();

            FbCommand fbCommand = new FbCommand();

            fbCommand.CommandText = sql;
            fbCommand.Connection = fbConnection;
            fbCommand.Transaction = fbTransaction;

            FbDataAdapter fbAdapter = new FbDataAdapter(fbCommand);
            fbAdapter.Fill(dt);
            fbTransaction.Commit();
            fbTransaction.Dispose();
            fbCommand.Dispose();
            fbAdapter.Dispose();

            return dt;
        }
开发者ID:TobiasBlankenhagen,项目名称:RivDic,代码行数:27,代码来源:Database.cs

示例12: UpdateTimeStampTest

		public void UpdateTimeStampTest()
		{
			string sql = "select * from TEST where int_field = @int_field";
			FbTransaction transaction = this.Connection.BeginTransaction();
			FbCommand command = new FbCommand(sql, Connection, transaction);
			FbDataAdapter adapter = new FbDataAdapter(command);
            adapter.MissingSchemaAction = MissingSchemaAction.AddWithKey;

			adapter.SelectCommand.Parameters.Add("@int_field", FbDbType.Integer).Value = 1;

			FbCommandBuilder builder = new FbCommandBuilder(adapter);

			DataSet ds = new DataSet();
			adapter.Fill(ds, "TEST");

			Assert.AreEqual(1, ds.Tables["TEST"].Rows.Count, "Incorrect row count");

			DateTime dtValue = DateTime.Now;

			ds.Tables["TEST"].Rows[0]["TIMESTAMP_FIELD"] = dtValue;

			adapter.Update(ds, "TEST");

			adapter.Dispose();
			builder.Dispose();
			command.Dispose();

			transaction.Commit();

			transaction = Connection.BeginTransaction();

			sql = "SELECT timestamp_field FROM TEST WHERE int_field = @int_field";
			command = new FbCommand(sql, Connection, transaction);
			command.Parameters.Add("@int_field", FbDbType.Integer).Value = 1;

			DateTime val = (DateTime)command.ExecuteScalar();

			transaction.Commit();

			Assert.AreEqual(dtValue.Day, val.Day, "timestamp_field has not correct day");
			Assert.AreEqual(dtValue.Month, val.Month, "timestamp_field has not correct month");
			Assert.AreEqual(dtValue.Year, val.Year, "timestamp_field has not correct year");
			Assert.AreEqual(dtValue.Hour, val.Hour, "timestamp_field has not correct hour");
			Assert.AreEqual(dtValue.Minute, val.Minute, "timestamp_field has not correct minute");
			Assert.AreEqual(dtValue.Second, val.Second, "timestamp_field has not correct second");
		}
开发者ID:masroore,项目名称:Firebird-NETProvider,代码行数:46,代码来源:FbDataAdapterTests.cs

示例13: FillMultipleTest

		public void FillMultipleTest()
		{
			FbTransaction transaction = this.Connection.BeginTransaction();
			FbCommand command = new FbCommand("select * from TEST", Connection, transaction);
			FbDataAdapter adapter = new FbDataAdapter(command);
            adapter.MissingSchemaAction = MissingSchemaAction.AddWithKey;

			FbCommandBuilder builder = new FbCommandBuilder(adapter);

			DataSet ds1 = new DataSet();
			DataSet ds2 = new DataSet();

			adapter.Fill(ds1, "TEST");
			adapter.Fill(ds2, "TEST");

			Assert.AreEqual(100, ds1.Tables["TEST"].Rows.Count, "Incorrect row count (ds1)");
			Assert.AreEqual(100, ds2.Tables["TEST"].Rows.Count, "Incorrect row count (ds2)");

			adapter.Dispose();
			builder.Dispose();
			command.Dispose();
			transaction.Commit();
		}
开发者ID:masroore,项目名称:Firebird-NETProvider,代码行数:23,代码来源:FbDataAdapterTests.cs

示例14: GetDataSet

        /*
        public static DataSet GetDataSet(string sql, CommandType commandType, int timeout)
        {

            FbDataAdapter adap = new FbDataAdapter(GetCommand(sql, commandType));
            DataSet dataSet = new DataSet();
            adap.SelectCommand.CommandTimeout = timeout;
            adap.Fill(dataSet);
            //definir tratamento e log de erros 
            adap.SelectCommand.Connection.Close();
            adap.SelectCommand.Connection.Dispose();
            adap.Dispose();
            return dataSet;
        }
         */

        public DataTable GetDataTable(string sql, CommandType commandType)
        {
            FbDataAdapter adap = new FbDataAdapter(GetCommand(sql, commandType));
            DataTable dataTable = new DataTable();
            adap.Fill(dataTable);
            //definir tratamento e log de erros 
            adap.SelectCommand.Connection.Close();
            adap.SelectCommand.Connection.Dispose();
            adap.Dispose();

            return dataTable;
        }
开发者ID:dramosti,项目名称:GeraXml_2.0,代码行数:28,代码来源:GenericDataAccess.cs

示例15: UpdateDecimalTest

		public void UpdateDecimalTest()
		{
			string sql = "select * from TEST where int_field = @int_field";
			FbTransaction transaction = this.Connection.BeginTransaction();
			FbCommand command = new FbCommand(sql, Connection, transaction);
			FbDataAdapter adapter = new FbDataAdapter(command);
            adapter.MissingSchemaAction = MissingSchemaAction.AddWithKey;

			adapter.SelectCommand.Parameters.Add("@int_field", FbDbType.Integer).Value = 1;

			FbCommandBuilder builder = new FbCommandBuilder(adapter);

			DataSet ds = new DataSet();
			adapter.Fill(ds, "TEST");

			Assert.AreEqual(1, ds.Tables["TEST"].Rows.Count, "Incorrect row count");

			ds.Tables["TEST"].Rows[0]["DECIMAL_FIELD"] = System.Int32.MaxValue;

			adapter.Update(ds, "TEST");

			adapter.Dispose();
			builder.Dispose();
			command.Dispose();

			transaction.Commit();

			transaction = Connection.BeginTransaction();

			sql = "SELECT decimal_field FROM TEST WHERE int_field = @int_field";
			command = new FbCommand(sql, Connection, transaction);
			command.Parameters.Add("@int_field", FbDbType.Integer).Value = 1;

			decimal val = (decimal)command.ExecuteScalar();

			transaction.Commit();

			Assert.AreEqual(System.Int32.MaxValue, val, "decimal_field has not correct value");
		}
开发者ID:masroore,项目名称:Firebird-NETProvider,代码行数:39,代码来源:FbDataAdapterTests.cs


注:本文中的FirebirdSql.Data.FirebirdClient.FbDataAdapter.Dispose方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。