PowerBuilder8.0 dynamically connected SQL Server skills

zhaozj2021-02-16  48

PowerBuilder8.0 dynamically connected SQL Server skills

We all know that PB is the most tight in connection with the database. So, it is important to master the connection of the PB and databases. Because the database connection is a bridge associated with the front and back. Below I will write the dynamic connection of PowerBuilder8.03 and MS SQL Server2000 and share with you:

First, create a connection.ini file, its content is: [Database] dbms = mssql sql server 2000Database = erp userid = sa databasepassword = logID = SALOGPASSWORD = servername = FamilyDbParm = lock = prompt = 0

Where: ERP refers to the database name you want to connect; sa is a database connection ID, Family means the computer name of the database you want to connect, or you can replace it with an IP address. Next, we have encoded in the OPEN event applied by the system: String ls_inifile = "connectionini"

// Database connection -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --- SQLCA.DBMS = ProfileString ("Dbconnect.ini", "Database", "DBMS", "") Sqlca.Database = ProfileString ("Dbconnect.ini", "Database", "Database", "" "SQLCA .logid = profilestring ("Dbconnect.ini", "Database", "LogID", "") SQLCA.Logpass = ProfileString ("Dbconnect.ini", "Database", "Logpassword", ") Sqlca.ServerName = ProfileString ("Dbconnect.ini", "Database", "ServerName", "") Sqlca.dbparm = ProfileString ("Dbconnect.ini", "Database", "dbparm", "" "sqlca.autocommit = true;

Connect Using SQLCA

IF SQLCA.SQLCODE <> 0 THEN

MessageBox ("Error", "You cannot connect to the database! Please check the database connection or INI configuration")

Else

END IF

At this point, PowerBuilder8.0 dynamically connected SQL Server skills are basically introduced. The purpose of writing this article is to communicate with you.

转载请注明原文地址:https://www.9cbs.com/read-26056.html

New Post(0)