From: | pairat(at)rachada(dot)com |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: The connection is dead |
Date: | 2006-01-08 07:29:09 |
Message-ID: | 1136705348.984320.91290@g43g2000cwa.googlegroups.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
I use ODBC instead of Npgsql because the ODBC can use with MS Access,
MS SQL and PostgreSQL database.
Here is the code.
System.DateTime dateTimeNow = System.DateTime.Now;
int i=0;
dataView1.RowFilter = "Posted = true";
dataView1.Sort = "GLTran, ID"; //GLTran Table
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["Employee_id"].Value =
DataRowView1["Employee_id"];
this.cmdInsert.Parameters["GJournal"].Value =
DataRowView1["GJournal"];
this.cmdInsert.Parameters["GJournalDT"].Value =
DataRowView1["GJournalDT"];
this.cmdInsert.Parameters["GLAccount"].Value =
DataRowView1["GLAccount"];
this.cmdInsert.Parameters["GLDescription"].Value =
DataRowView1["GLDescription"];
this.cmdInsert.Parameters["GLCredit"].Value =
DataRowView1["GLCredit"];
this.cmdInsert.Parameters["GLDebit"].Value = DataRowView1["GLDebit"];
this.cmdInsert.Parameters["GLTran"].Value = DataRowView1["GLTran"];
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);
}
}
if (_Journal == "JP" | _Journal == "JR )
{
this.cmdUpdate2.Parameters["Posted"].Value = true;
this.cmdUpdate2.Parameters["GLTran"].Value = ataRowView1["GLTran"];
try
{
this.cmdUpdate2.ExecuteNonQuery();
}
catch (System.Exception ex)
{
this.RollBack(ex.Message);
}
}
}
Thank you for your comment.
Pairat
From | Date | Subject | |
---|---|---|---|
Next Message | Kris Jurka | 2006-01-08 08:17:19 | Re: [JDBC] SQLData user-defined-types and getObject() |
Previous Message | Postgres User | 2006-01-08 04:19:16 | Installing Postgres 8.1 on Windows Server 2003 R2 |