Working with Power Builder Data Window

1) create a custom object with  n_Connection  name and class with GetConn and  return as transcation data type...

// Profile myprofile
Transaction trans
SQLCA.DBMS = "SNC SQL Native Client(OLE DB)"
SQLCA.LogPass = "**************"
SQLCA.ServerName = "000.000.000.000"
SQLCA.LogId = "User ID"
SQLCA.AutoCommit = False
SQLCA.DBParm = "Database='Database Name',Provider='SQLNCLI10',TrustedConnection=1"
connect using sqlca;
trans=sqlca
return trans


2) Bind Data window...

n_Connection obj
obj = create n_Connection
Transaction tran
tran  = create Transaction
tran=obj.GetConn()
connect using tran;
datawindow.SetTransObject(tran)
datawindow.Retrieve()
disconnect using tran;

3) Update record after change data in grid itself...

n_Connection obj
obj = create n_Connection
Transaction tran
tran  = create Transaction
tran=obj.GetConn()
connect using tran;
datawindow.SetTransObject(tran)
datawindow.Update(true)
datawindow.Retrieve()
commit using tran;
disconnect using tran;

4) Delete record ...

n_Connection obj
obj = create n_Connection
Transaction tran
tran  = create Transaction
tran=obj.GetConn()
connect using tran;
datawindow.SetTransObject(tran);
datawindow.DeleteRow(datawindow.Object.NewsID)
datawindow.Update()
datawindow.Retrieve();
commit using tran;
disconnect using tran;









Comments

Popular posts from this blog

How to create RSS Feed in Asp.Net

Auto generate change scripts in SQL Server Management Studio SSMS for tables

HOW TO Use the NumericUpDown Control