Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

New question regarding Transaction Objects

5 posts in DataWindow .NET Last posting was on 2004-12-02 08:37:19.0Z
DGerdner Posted on 2004-12-01 18:48:04.0Z
From: "DGerdner" <dave@ptax.org>
Newsgroups: sybase.public.datawindow.net
Subject: New question regarding Transaction Objects
Lines: 13
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
NNTP-Posting-Host: ool-4353a821.dyn.optonline.net
X-Original-NNTP-Posting-Host: ool-4353a821.dyn.optonline.net
Message-ID: <41ae11e4$1@forums-1-dub>
Date: 1 Dec 2004 10:48:04 -0800
X-Trace: forums-1-dub 1101926884 67.83.168.33 (1 Dec 2004 10:48:04 -0800)
X-Original-Trace: 1 Dec 2004 10:48:04 -0800, ool-4353a821.dyn.optonline.net
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.datawindow.net:852
Article PK: 125279

I'm a PB programmer switching to C#. I've installed the dw.NET eval copy
and have a question regarding transaction objects. In PB we usually created
one transaction object and used it throughout the application. But in the
samples for dw.NET it always shows placing a transaction object on an
individual form. Is there a way to create a transaction object that can be
used in multiple forms throughout an application?

--
David L Gerdner
Next Generation Software, Inc.
201-571-0425


FrankG Posted on 2004-12-01 18:58:30.0Z
Sender: 4b21.41ae135b.1804289383@sybase.com
From: FrankG
Newsgroups: sybase.public.datawindow.net
Subject: Re: New question regarding Transaction Objects
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <41ae1456.4b45.1681692777@sybase.com>
References: <41ae11e4$1@forums-1-dub>
NNTP-Posting-Host: 10.22.241.41
X-Original-NNTP-Posting-Host: 10.22.241.41
Date: 1 Dec 2004 10:58:30 -0800
X-Trace: forums-1-dub 1101927510 10.22.241.41 (1 Dec 2004 10:58:30 -0800)
X-Original-Trace: 1 Dec 2004 10:58:30 -0800, 10.22.241.41
Lines: 24
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.datawindow.net:853
Article PK: 125278

Sent the same question to Sybase via email. Looks like the
solution is to create a seperate class and make it status.
Can then share the static class members throughout the
application. I hope to have this working in my MDI
application by tonight. If so, I will post the class code.
Hoping to name it SQLCA and provide fields similar to the
current SQLCA object.

> I'm a PB programmer switching to C#. I've installed the
> dw.NET eval copy and have a question regarding transaction
> objects. In PB we usually created one transaction object
> and used it throughout the application. But in the
> samples for dw.NET it always shows placing a transaction
> object on an individual form. Is there a way to create a
> transaction object that can be used in multiple forms
> throughout an application?
>
> --
> David L Gerdner
> Next Generation Software, Inc.
> 201-571-0425
>
>


FrankG Posted on 2004-12-02 04:13:50.0Z
Sender: 517c.41ae95e3.1804289383@sybase.com
From: FrankG
Newsgroups: sybase.public.datawindow.net
Subject: Re: Shared Transaction Object - Couldn't get it to work.
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <41ae967e.5188.1681692777@sybase.com>
References: <41ae1456.4b45.1681692777@sybase.com>
NNTP-Posting-Host: 10.22.241.41
X-Original-NNTP-Posting-Host: 10.22.241.41
Date: 1 Dec 2004 20:13:50 -0800
X-Trace: forums-1-dub 1101960830 10.22.241.41 (1 Dec 2004 20:13:50 -0800)
X-Original-Trace: 1 Dec 2004 20:13:50 -0800, 10.22.241.41
Lines: 83
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.datawindow.net:858
Article PK: 125284

Trying to share a transaction object with constructing
multiple instances of the transaction object.

This works in a window without sharing. Manually setting
the transaction object parameters. Noticed the code creates
an instance of the transaction object. Don't think we want
to create another instance, since it would need to connect
again.

private Sybase.DataWindow.Transaction transaction1;

transaction1.AutoCommit = false;
transaction1.DbParameter =
"ConnectString='SN=myPubs;UID=;PWD=;,DelimitIdentifier='NO';CommitOnDisconnect='NO'";
transaction1.Dbms = Sybase.DataWindow.DbmsType.Odbc;
transaction1.Connect();
dwc1.SetTransaction(transaction1);
dwc1.Retrieve();

Created a class with static variables to allow me to connect
using SQLCA.ConnectToDatabase(). Changed the window calls
to connect using the static function. Always get an error
when I issue the connect command. gTransaction is always
null
"An unhandled exception of type
'System.NullReferenceException' occurred in dbEdge.exe

Additional information: Object reference not set to an
instance of an object."


using System;
using System.ComponentModel;
using Sybase.DataWindow;

namespace dbEdge
{
/// <summary>
/// Summary description for SQLCA.
/// </summary>
public class SQLCA
{
public static Sybase.DataWindow.Transaction gTransaction;
public static bool autoCommit = false;
public static string DBParameter =
"ConnectString='DSN=myPubs;UID=;PWD=;,DelimitIdentifier='NO';
CommitOnDisconnect='NO'";
public static string DBMS = "ODBC";
public static bool isConnected = false;

public SQLCA()
{

//
// TODO: Add constructor logic here
//
}

public static void ConnectToDatabase()
{

gTransaction.AutoCommit = autoCommit;
gTransaction.DbParameter = DBParameter;
if (DBMS == "ODBC")
gTransaction.Dbms = Sybase.DataWindow.DbmsType.Odbc;
else if (DBMS == "ORACLE8")
gTransaction.Dbms = Sybase.DataWindow.DbmsType.Oracle8i;
else if (DBMS == "ORACLE9")
gTransaction.Dbms = Sybase.DataWindow.DbmsType.Oracle9i;
gTransaction.Connect();

isConnected = true;
}

public static void DisconnectFromDatabase()
{
gTransaction.Disconnect();
isConnected = false;
}


}
}


Jim O'Neil [Sybase] Posted on 2004-12-02 05:20:31.0Z
From: "Jim O'Neil [Sybase]" <joneil_at_sybase_dot_com>
Newsgroups: sybase.public.datawindow.net
Subject: Re: Shared Transaction Object - Couldn't get it to work.
Message-ID: <lc9tq0h3457u7m8g349hdmu9evclgko4t3@4ax.com>
References: <41ae1456.4b45.1681692777@sybase.com> <41ae967e.5188.1681692777@sybase.com>
X-Newsreader: Forte Agent 2.0/32.652
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: vpn-concord-075.sybase.com
X-Original-NNTP-Posting-Host: vpn-concord-075.sybase.com
Date: 1 Dec 2004 21:20:31 -0800
X-Trace: forums-1-dub 1101964831 158.159.8.75 (1 Dec 2004 21:20:31 -0800)
X-Original-Trace: 1 Dec 2004 21:20:31 -0800, vpn-concord-075.sybase.com
Lines: 91
X-Authenticated-User: teamsybase
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.datawindow.net:859
Article PK: 125285

You haven't create an instance of the SQLCA class hence the null
object reference. I think what you are wanting to do is implement a
singleton pattern - you should be able to find a template for doing
that on the web.

On 1 Dec 2004 20:13:50 -0800, FrankG wrote:

>Trying to share a transaction object with constructing
>multiple instances of the transaction object.
>
>This works in a window without sharing. Manually setting
>the transaction object parameters. Noticed the code creates
>an instance of the transaction object. Don't think we want
>to create another instance, since it would need to connect
>again.
>
>private Sybase.DataWindow.Transaction transaction1;
>
>transaction1.AutoCommit = false;
>transaction1.DbParameter =
>"ConnectString='SN=myPubs;UID=;PWD=;,DelimitIdentifier='NO';CommitOnDisconnect='NO'";
>transaction1.Dbms = Sybase.DataWindow.DbmsType.Odbc;
>transaction1.Connect();
>dwc1.SetTransaction(transaction1);
>dwc1.Retrieve();
>
>Created a class with static variables to allow me to connect
>using SQLCA.ConnectToDatabase(). Changed the window calls
>to connect using the static function. Always get an error
>when I issue the connect command. gTransaction is always
>null
>"An unhandled exception of type
>'System.NullReferenceException' occurred in dbEdge.exe
>
>Additional information: Object reference not set to an
>instance of an object."
>
>
>using System;
>using System.ComponentModel;
>using Sybase.DataWindow;
>
>namespace dbEdge
>{
> /// <summary>
> /// Summary description for SQLCA.
> /// </summary>
> public class SQLCA
> {
> public static Sybase.DataWindow.Transaction gTransaction;
> public static bool autoCommit = false;
> public static string DBParameter =
>"ConnectString='DSN=myPubs;UID=;PWD=;,DelimitIdentifier='NO';
>CommitOnDisconnect='NO'";
> public static string DBMS = "ODBC";
> public static bool isConnected = false;
>
> public SQLCA()
> {
>
> //
> // TODO: Add constructor logic here
> //
> }
>
> public static void ConnectToDatabase()
> {
>
> gTransaction.AutoCommit = autoCommit;
> gTransaction.DbParameter = DBParameter;
> if (DBMS == "ODBC")
> gTransaction.Dbms = Sybase.DataWindow.DbmsType.Odbc;
> else if (DBMS == "ORACLE8")
> gTransaction.Dbms = Sybase.DataWindow.DbmsType.Oracle8i;
> else if (DBMS == "ORACLE9")
> gTransaction.Dbms = Sybase.DataWindow.DbmsType.Oracle9i;
> gTransaction.Connect();
>
> isConnected = true;
> }
>
> public static void DisconnectFromDatabase()
> {
> gTransaction.Disconnect();
> isConnected = false;
> }
>
>
> }
>}


Gzim Posted on 2004-12-02 08:37:19.0Z
From: "Gzim" <the_matrix_3005@gmx.net>
Newsgroups: sybase.public.datawindow.net
References: <41ae11e4$1@forums-1-dub>
Subject: Re: New question regarding Transaction Objects
Lines: 26
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1437
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441
X-Original-NNTP-Posting-Host: zux006-057-206.adsl.green.ch
Message-ID: <41aed43d@forums-2-dub>
X-Original-Trace: 2 Dec 2004 00:37:17 -0800, zux006-057-206.adsl.green.ch
X-Original-NNTP-Posting-Host: forums-2-dub.sybase.com
X-Original-Trace: 2 Dec 2004 00:37:18 -0800, forums-2-dub.sybase.com
NNTP-Posting-Host: forums-master.sybase.com
X-Original-NNTP-Posting-Host: forums-master.sybase.com
Date: 2 Dec 2004 00:37:19 -0800
X-Trace: forums-1-dub 1101976639 10.22.108.75 (2 Dec 2004 00:37:19 -0800)
X-Original-Trace: 2 Dec 2004 00:37:19 -0800, forums-master.sybase.com
X-Authenticated-User: ngsysop
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.datawindow.net:862
Article PK: 125288

SQLCA is not really OOP.

Try to create a Singleton of your transaction-class...(singleton-class are
not possible in PB)

gzim.

"DGerdner" <dave@ptax.org> schrieb im Newsbeitrag
news:41ae11e4$1@forums-1-dub...

> I'm a PB programmer switching to C#. I've installed the dw.NET eval copy
> and have a question regarding transaction objects. In PB we usually
created
> one transaction object and used it throughout the application. But in the
> samples for dw.NET it always shows placing a transaction object on an
> individual form. Is there a way to create a transaction object that can
be
> used in multiple forms throughout an application?
>
> --
> David L Gerdner
> Next Generation Software, Inc.
> 201-571-0425
>
>