---- 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:
毕业论文http://www.751com.cn/
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 '