C # Call pb dll files

Source: Internet
Author: User
Tags sybase first row
In C #, the Datawindow. Net component processes data. Datawindow. Net is a data access component developed by PB for MS. Net.

    1. Install

First install. net2003, Framework Version 1.1, then install the DataWindow. Net component and design the compilation environment.

After installation, The Sybase DataWindow control tab is displayed during the design of the. net2003 form.

    2. Use DataWindow

Controls can be directly used in the C # form.

    3. Design DataWindow

Design Data windows in the PB or DataWindow design environment and store them in. pbl for program calls.

After the release, it can be compiled into the. pbd file format.

   4. Call DataWindow in c #

A) create a Datawindow control on the form and name it dw.

B) create a Transaction control on the form and name it Trans.

C) initialize the Transaction control.

Trans. dbms = Sybase. dataWindow. dbmsType. oleDb; // database connection method Trans. password = "123"; Trans. userID = "sa"; Trans. autoCommit = false; Trans. lock = "RC"; Trans. dbParameter = "PROVIDER = 'sqloledb', DATASOURCE = 'xiance', PROVIDERSTRING = 'database = Demo'"; // database connection string Trans. connect (); // Connect to the database

D) display data window

Dw. libraryList = "test. pbl "; // used after release. pbd file dw. dataWindowObject = "datawindowName"; // data window name dw. setTransaction (Trans); dw. retrieve (); // Display data window

E) close the connection.

Trans. Disconnect ();

    5. c # Use the DataWindow control to operate data

A) add

Int row = this. dw. insertRow (0); // Insert a record dw. setRow (row); dw. setItemString (row, "ID", "100"); // assign the dw value to the field. setItemString (row, "name", "name"); // assign a value to the field

B) Delete

This. dw. DeleteRow (1); // delete the first row of record

C) save

This. dw. UpdateData (true, true); Trans. Commit (); // data is written to the database after being submitted.

    6. Description

    The above is just a brief description of the usage of DataWindow in c #. In actual development, there will be many details, especially when designing the data window.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.