SoFunction
Updated on 2025-04-12

Detailed explanation of the method of linking DB2 OLEDB instances of Yi Language

Many friends need to use links to DB2 and other content when writing Easy Language software, please refer to it.

‘database=rbsj; this is the name of the database, Hostname=PC-200806261910;” This is the name of your own computer,

If true (Database connection.Connection ("Provider=IBMDADB2;database=rbsj;Hostname=PC-200806261910;")))

sql = “SELECT * FROM ”

.Version 2
.Support library eDB
.Support library eGrid

.If true (Record set.Open (sql, #SQL statement) = true)' If true (Record set.Open并排序 (“Daily data”, "Number sorting up"))
Information box (“Connected table”, #Error icon, "Connect database error")Advanced Form1.Clear data ()
Advanced Form1.Number of rows in the table = 1
Advanced Form1.Number of header columns = 0
Advanced Form1.Number of rows = Record set.Number of records + 1
Advanced Form1.Number of columns = Record set.Number of fields
' Advanced Form1.Set data (0, 0, #Table constant.Text type, to text ("tag")).Cycle first (Record set.Number of fields, variable1)
Advanced Form1.Set data (0, variable1 - 1, #Table constants. Text type, record set. Take the field name (variable 1 - 1)).Calculate the cycle ()
To the first record ()
.Cycle first (Record set.Number of records, variable2)
.Cycle first (Record set.Number of fields, variable1)
Record set.Read the text (variable1 - 1, unit)
Advanced Form1.Set data (variable2, variable1 - 1, #Table constants. Text type, unit)' Advanced Form1.Set data (variable2, 1 - 1, #Table constant.Text type, to text (record set.Take field name (0))).Calculate the cycle ()
Record set.Go to the next one ()
.Calculate the cycle ()

Thank you for your support.