Sybase anywhere (2) on Wm)

Source: Internet
Author: User

GuideArticle:《Sybase anywhere (1) on Wm)"

In the previous article, we talked about how to install Sybase anywhere 11 in the WM system and test whether the database is available and normal.

This article mainly describes how to operate its database in the WM system.

When we have installed a demo. DB database instance in the WM system, we will use the instance database.

First, let's take a look at what is in this database.

How can I access the database tables of the WM system? Connect WM to the system and copy the database.

Start Sybase Central and choose "Connect"> "Connect with SQL Anywhere 11" from the menu"

In the connection dialog box, enter the user name and password.

On the "Database" tab, select a database file. Or you can start the service of a database instance on your own.

Finally, Sybase Central automatically starts a database instance service. The following describes the existing content in the database and the operations that can be implemented.

Table, view, index, trigger, process, and function are all in the original database. This is what the Sybase anywhere 11 database can provide. Is it more powerful than SQL ce3.5.

I will not talk much about it. I have introduced how to view the specific content in the database instance. Next I will introduce how to use. Net CF to access the Sybase anywhere 11 database.

Create a project and add ianywhere. Data. sqlanywhere references. The dll contains the following key objects connecting to the database.
Saconnection: database connection object.
Sacommend: Database Command Execution object.
Sadatareader: Data cursor operation object.
Sadataadapter: Data filling/adapter object.
Satransaction: Database Transaction object.
Saparamter: database parameter object.

From the naming of these objects, we can clearly see that SA is added before the naming, which is consistent with the data operation objects in. net. The vast majority of methods are consistent. Only some better attributes and methods are added.

In the demo, all the data is retrieved from the database, and all the description data is displayed when a row of data is selected.
Run the demo.

This dialog box appears when you click load data. Why ??
Cause Analysis: Sybase anywhere uses ODBC for data connection. In fact, the name of the DSN is entered in the connection string. When the connection is opened, find the DSN File first, and then use ODBC to connect according to the information configured in the DSN File.

String Connectionstring =   @" Data Source = SQL Anywhere 11 demo; pooling = true; Max pool size = 50; " ;

Datasource = SQL Anywhere 11 demo indicates the DSN name

What is the information in the DSN File? Let's take a look at the DSN of the database instance provided by Sybase anywhere 11.
Uid = DBA
Pwd = SQL
Enginename = demo
Databasename = demo
Databasefile = \ My Documents \ demo. DB
Start = \ storage card \ Program Files \ sqlany11 \ dbsrv11.exe

The above is the information copied from DSN.
UID indicates the user name
PWD indicates the password
Enginename indicates the name of the connection engine.
Databasename indicates the database instance name
Databasefile indicates the current database location
Start indicates that dbsrv11.exe of Sybase anywhere 11.pdf is usedProgramStart the database.
This file is the application that starts the database service. After the database is started, saconnection can be connected to the database through ODBC.

This is why the dialog box appears, and the information described in the dialog box tells you what it is doing.

Sadatareader provides fieldcount (the total number of rows of data in the query result set) and depth ).

Table (nolock) is not supported when select queries are used. This statement is only applicable to SQL Server.

The above is a rough introduction to how to operate the Sybase anywhere 11 database on WM.

CodeDownload: sybasedemo.rar

Running Environment: vs2008+ Wm6.0 +. Net cf3.5 + Sybase anywhere 11

Author: appleseeker (Feng)
Date: 2009-04-14

introduction: mobile development index

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: 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.