1 / 63

PWB508: DataWindow . NET, Usage, Features and Roadmap

PWB508: DataWindow . NET, Usage, Features and Roadmap. David Avera Staff Engineer davera@sybase.com August 15-19, 2004. The Enterprise. Unwired. The Enterprise. Unwired. Industry and Cross Platform Solutions. Manage Information. Unwire Information. Unwire People.

salome
Download Presentation

PWB508: DataWindow . NET, Usage, Features and Roadmap

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. PWB508: DataWindow .NET, Usage, Features and Roadmap David Avera Staff Engineer davera@sybase.com August 15-19, 2004

  2. The Enterprise. Unwired.

  3. The Enterprise. Unwired. Industry and Cross Platform Solutions Manage Information Unwire Information Unwire People • Adaptive Server Enterprise • Adaptive Server Anywhere • Sybase IQ • Dynamic Archive • Dynamic ODS • Replication Server • OpenSwitch • Mirror Activator • PowerDesigner • Connectivity Options • EAServer • Industry Warehouse Studio • Unwired Accelerator • Unwired Orchestrator • Unwired Toolkit • Enterprise Portal • Real Time Data Services • SQL Anywhere Studio • M-Business Anywhere • Pylon Family (Mobile Email) • Mobile Sales • XcelleNet Frontline Solutions • PocketBuilder • PowerBuilder Family • AvantGo Sybase Workspace

  4. Terminology • The Microsoft .NET Framework • The class library • Comprehensive library, everything from soup to nuts. • The Common Language Runtime • MSIL – Microsoft Intermediate Language • Just in time compiling • The runtime execution engine (it is NOT a VM) • Managed execution.

  5. Terminology • Interoperation • The ability of .NET managed programs to communicate and Interoperate with non-managed programs. • Allows the use of legacy programs without massive conversions.

  6. As of last year’s TechWave • The DataWindow .NET prototype was demonstrated at TechWave 2003 • Most of the DataWindow methods worked. • Most of the functionality was in place. • We had proven that our model would work and that DataWindows could be implemented under the .NET Framework

  7. During the last year • Continuous refactoring and refinement. • We adopted naming conventions more in line with .NET standards. • We overlayed an object model over the DataWindow engine (aka DataWindow server). • This model will continue to be enhanced.

  8. Installed Components • Managed Assemblies • DataWindow.DLL • The front end for DataWindow .NET • This is what your program interacts with • DataWindowInterop.DLL • Manages communication with the DataWindow server • Performs data marshalling as necessary • PBData100.DLL • Interface to ADO .NET

  9. Installed components • Unmanaged components • PBDWN100.DLL • PBSHR100.DLL • The same one as PowerBuilder uses. • Database drivers • The same ones that PowerBuilder uses

  10. Create an application using DataWindow .NET • Create a new C# project

  11. Drop a DataWindowControl on the form • Select DataWindowControl from the Sybase tab in the toolbox

  12. The DataWindow Reference • When you drop a DataWindowControl, DataStore or a Transaction onto a Form a reference is created to DataWindow

  13. Reference Properties • Take note of the path and the CopyLocal properties

  14. Size the DataWindowControl • Displayed as below

  15. Add a transaction object • Again, using the toolbox.

  16. The transaction object added • The transaction object is displayed off of the form.

  17. Define the transaction properties • RMB on the transaction and select properties

  18. Test our transaction object • RMB on the SQLCA object and select “Test Connection”

  19. Set some DataWindowControl properties • LibraryList

  20. Set some DataWindowControl properties • DataWindow object

  21. The form with a DataWindow

  22. Access the Design Tool • DataWindow Designer

  23. Use the Design Tool • It’s the same as the PowerBuilder DataWindow Painter

  24. Reload the DataWindow Object

  25. Add code to connect and retrieve • Use the form’s Load event

  26. Code the Connect and SetTransaction

  27. Code the Retrieve

  28. Run the Application

  29. Hooray!

  30. Exploring DataWindow .NET • Using the Visual Studio Object Browser

  31. Exploring DataWindow .NET

  32. DataWindow .NET Interfaces • IDataWindowBase • Many (in fact most) of the methods you are familiar with in the PowerBuilder DataWindow

  33. DataWindow .NET Interfaces • IDataStore • Inherits IDataWindowBase and adds remoting.

  34. DataWindow .NET Interfaces • IDataWindow • Adds UI related methods and properties

  35. Principle DataWindow .NET Classes • DataWindowControl • The visual container for a DataWindow object • Inherits from System.Windows.Form.Control • Implements the IDataWindow interface • DataStore • The non visual container for a DataWindow object • Inherits from System.ComponentModel.Component • Implements the IDataStore interface

  36. Principle DataWindow .NET Classes • Transaction • Inherits System.ComponentModel.Component • DataWindowChild • Represents a child DataWindow, either a Drop Down DataWindow or nested child DataWindow. • Implements IDataWindowBase. • GraphicObject and descendents • Represents an object on a DataWindowControl or within a DataStore.

  37. Use the Object Browser

  38. Database Operations in DataWindow .NET • Two transaction classes are used • Sybase.DataWindow.Transaction • Enables the use of the PowerBuilder DBI to connect to a database and manage the transaction. • Sybase.DataWindow.AdoTransaction • Enables the sharing of an ADO .NET database connection • Only OleDbConnection is supported in the first release. .

  39. Database Operations in DataWindow .NET • Methods for Setting Database Connection into DataWindow • IDataWindowBase.SetTransaction(Sybase.DataWindow.Transaction) • IDataWindowBase.SetTransaction(Sybase.Datawindow.AdoTransaction)

  40. Database Operations in DataWindow .NET • Using the Transaction object • SQLCA.Connect( ); • ds_1.SetTransaction(SQLCA); • ds_1.Retrieve(); • // change data • ds_1.SetItemString(2, 1, “Sybase”); • // update database • ds_1.UpdateData(); • // commit data • SQLCA.Commit();

  41. Database Operations in DataWindow .NET • Using AdoTransaction • System.Data.OleDb.OleDbConnection oleDbConn = new System.Data.OleDb.OleDbConnection(); • oleDbConn.ConnectionString = @"User ID=dba; Password=sql;Data Source=EAS Demo DB V4; Provider=\"ASAProv.90\""; • oleDbConn.Open(); • AdoTransaction myAdoTrans = new AdoTransaction(oleDbConn, null); • // After calling BindConnection, you will find IsBound become true. • myAdoTrans.BindConnection();

  42. Database Operations in DataWindow .NET • Using AdoTransaction • DataStore ds_1 = new DataStore(); • // Start an ADO.NET Transaction • System.Data.OleDb.OleDbTransaction myOleDbTrans; • myOleDbTrans = oleDbConn.BeginTransaction(); • // Create a DataWindow transaction • Sybase.DataWindow.Transaction myAdoTrans = new Sybase.DataWindow.Transaction( );

  43. Database Operations in DataWindow .NET • Using AdoTransaction • // For any DataWindow db operation, you must bind the ADO.NET connection to the DataWindow .NET transaction • myAdoTrans.Transaction = myOleDbTrans; • ds_1.SetTransaction(myAdoTrans); • ds_1.Retrieve(); • ds_1.SetItemString(1, “dept_name”, “ADC”); • ds_1.UpdateData(); • myOleDbTrans.Commit(); // Commit the changes • // OR myOleDbTrans.Rollback(); // Rollback the changes.

  44. DataWindow .NET Events • Events are implemented using the .NET delegate model. • Some event names differ from the PowerBuilder names so as to conform to .NET naming styles.

  45. DataWindow .NET Events

  46. DataWindow .NET Events • The interfaces determine which events apply to which objects.

  47. DataWindow .NET Events • Event arguments are classes • Many argument properties use enumerations

  48. DataWindow .NET Events • About Mouse events • The PowerBuilder mouse events supply parameters specific to the DataWindowControl • DataWindow .NET mouse events supply the same arguments as regular .NET mouse events. • Use the DataWindowControl’s “ObjectUnderMouse” property for one stop shopping.

  49. DataWindow .NET Events • ObjectUnderMouse

  50. DataWindow .NET Events • Sample code using ObjectUnderMouse private void MyMouseDown(object sender, System.Windows.Forms.MouseEventArgs e) { ObjectAtPointer OAP = dataWindowControl1.ObjectUnderMouse; Sybase.DataWindow.GraphicObject GOB = OAP.Gob; if ( GOB is GraphicObjectEditableColumn ) { GraphicObjectEditableColumn EditGob = (GraphicObjectEditableColumn) GOB; MessageBox.Show ( "ColumnName = " + EditGob.Name ); } }

More Related