DELPHI办公管理系统 第7页

DELPHI办公管理系统 第7页
merit and so on seal, hideaway as well as code pre- translation, reduced network load, maintenance convenience, therefore does by many RDBMS and the programming tool the support. In VB each 类数 also provides to saves the process according to the object the support.

---- We as regularly explain its realization take ADO the step

---- 1. Foundation, debugging memory process. You may also be allowed to hang the procedure in the database outside other under the support carry on the memory process the foundation and the debugging work. In this example memory process code is as follows (uses in PUBS MS SQL the example storehouse):

CREATE PROCEDURE myprocedure
@job_id smallint,
@job_lvl tinyint
AS
SELECT *
FROM employee
WHERE job_id < @job_id
AND job_lvl > @job_lvl


---- 2. Produces one new project in VB, the project has one window, one COMMAND (NAME: COMMAND1) button, one MSFlexGrid (NAME: MSFlexGrid1) controls.
---- 3. The foundation connects ADO connection;

---- 4. The foundation orders ADO command;

---- 5. The foundation parameter and establishes each parameter the attribute;

---- 6. Carries out ADO command;

---- 7. The logarithm according to carries on processing; MSFlexGrid demonstrates inquires data

---- 8. The release connects, withdrawal procedure.

---- Code as follows:

States below the variable in the window:
Dim cnn1 As ADODB.Connection ' connects
Dim mycommand As ADODB.Command ' orders
Dim parm_jobid As ADODB.Parameter ' parameter 1
Dim parm_joblvl As ADODB.Parameter ' parameter 2
Dim rstByQuery As ADODB.Recordset ' result collection
Dim strCnn As String ' connection character string

Joins the following code in the window LOAD event:
Set cnn1 = New ADODB.Connection
' Produces one connects
strCnn = \ " DSN=MYDSN; uid=sa; pwd=\ "
' Foundation system data pool MYDSN aims at the PUBS database
cnn1.Open strCnn ' opens connects
Joins the code as follows in window UNLOAD:
cnn1.Close ' the closure connects
Set cnn1 = Nothing ' the release connects

In button code as follows:
Dim i As integer
Dim j as integer
Set parm_jobid = New ADODB.Parameter
Set mycommand = New ADODB.Command
\' parm_jobid.Name = \ " name1\ "
this line can be ommited
parm_jobid.Type = adInteger '中文部分请见论坛中英文文献栏目<电路交换网与vb调用数据库>

上一页  [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]  ... 下一页  >> 

Copyright © 2007-2012 www.chuibin.com 六维论文网 版权所有