Re: The connection is dead

Поиск
Список
Период
Сортировка
От pairat@rachada.com
Тема Re: The connection is dead
Дата
Msg-id 1136684336.607257.309040@g49g2000cwa.googlegroups.com
обсуждение исходный текст
Ответ на Re: The connection is dead  ("Jonel Rienton" <jonel@rientongroup.com>)
Список pgsql-general
Hi Jonel

Thank you for your response. I use ODBC instead of Npgsql because the
program can use with MS Access, MS SQL and PostgreSQL.

Here is the code.


int n = this.BindingContext[dataView1].Count - 1;
string _Journal;
DataRowView DataRowView1;
this.cmdInsert.Transaction = _Transaction;
this.cmdDelete.Transaction = _Transaction;
this.cmdDelete1.Transaction = _Transaction;
this.cmdUpdate1.Transaction = _Transaction;
this.cmdUpdate2.Transaction = _Transaction;

for(i=0; i<=n; i++)
{
    this.BindingContext[dataView1].Position = i;
    DataRowView1 = (DataRowView) this.BindingContext[dataView1].Current;
    this.cmdInsert.Parameters["CustomerID"].Value = string.Empty;
    this.cmdInsert.Parameters["Employee_id"].Value =
DataRowView1["Employee_id"];
    this.cmdInsert.Parameters["GJournal"].Value =
DataRowView1["GJournal"];
    this.cmdInsert.Parameters["GJournalDT"].Value =
DataRowView1["GJournalDT"];
                this.cmdInsert.Parameters["TransactionDate"].Value =
dateTimeNow;

                this.cmdDelete.Parameters["ID"].Value =
DataRowView1["ID"];
    try
    {
         this.cmdInsert.ExecuteNonQuery();
    }
    catch (System.Exception ex)
    {
          this.RollBack(ex.Message);
    }
    try
    {
          this.cmdDelete.ExecuteNonQuery();
    }
    catch (System.Exception ex)
    {
          this.RollBack(ex.Message);
    }

    _Journal = DataRowView1["GJournal"].ToString().Trim();
    if (_Journal == "JP" | _Journal == "JR" )
    {
          this.cmdDelete1.Parameters["GLTran"].Value =
DataRowView1["GLTran"];
    try
    {
          this.cmdDelete1.ExecuteNonQuery();
    }
    catch (System.Exception ex)
    {
          this.RollBack(ex.Message);
    }

    this.cmdUpdate1.Parameters["Posted"].Value = true;
    this.cmdUpdate1.Parameters["GLTran"].Value = DataRowView1["GLTran"];

    try
    {
            this.cmdUpdate1.ExecuteNonQuery();
    }
    catch (System.Exception ex)
    {
            this.RollBack(ex.Message);
    }
}


В списке pgsql-general по дате отправления:

Предыдущее
От: pairat@rachada.com
Дата:
Сообщение: Re: The connection is dead
Следующее
От: Tom Lane
Дата:
Сообщение: Re: userdefined types