The code belows shows how u can access your stored procedures from vb6.
In the example i use an input and output parameter so it is possible to select, update, insert data into the MS SQL 2000 database.
Stored procedure
CREATE Procedure MyStoredProcdure
(@ID integer,
@Description varchar(100) output
)
AS
select @Description = Description
from dbo.MNZ_FOTO
WHERE ID = @ID
GO
vb code
On Error GoTo ErrHandler
Set cn = New ADODB.Connection
cn.ConnectionString = Session.GetConnectionstring
cn.OpenSet cmd = New ADODB.Command
cmd.ActiveConnection = cn
cmd.CommandType = adCmdStoredProc
cmd.CommandText = “MyStoredProcdure”
cmd.Parameters.Append cmd.CreateParameter(“ID”, adInteger, adParamInput, , 614)
cmd.Parameters.Append cmd.CreateParameter(“Description”, adVarChar, adParamOutput, 100)
cmd.ExecuteMsgBox cmd.Parameters(1).Value
Set cmd = Nothing
Set cn = Nothing
Exit Function
ErrHandler:
MsgBox Err.Description
Set cmd = Nothing
Set cn = Nothing
Popularity: 3% [?]
RSS feed for comments on this post · TrackBack URI
Leave a reply