Link to home
Start Free TrialLog in
Avatar of Schuttend
Schuttend

asked on

How to call a sql server procedure from within vb6?

Hello,

Can somebody give me an example how to call a function or procedure in sql server from within vb6 using ADO?

Regards,
Dennis
Avatar of openshac
openshac


' Set up a command object for the stored procedure.
With ADOcmd
    .ActiveConnection = conProdDB
    .CommandText = "myProcName"
    .CommandType = adCmdStoredProc
 
' Set up input parameters.  
    .Parameters.Append .CreateParameter("@MyParam", adInteger, adParamInput, , 40027)
 
' Execute command
    .Execute
End With
   
Set ADOcmd = Nothing

Open in new window

Avatar of Schuttend

ASKER

I noticed that a value is send from vb6 code to the stored procedure.
Is it also possible to have a return value?

regards,
Dennis
ALTER PROCEDURE [dbo].[importeren5] 
	
AS
    -- Insert statements for procedure here
	drop table CSVtest99
	create Table CSVtest99
	(	Datum  VARCHAR(30),
	Signal VARCHAR(30),
	Equity VARCHAR(30)
	
	)
	
	BULK insert csvtest99
	FROM 'c:\structure\test.txt'
	WITH
	(
	FIELDTERMINATOR =',',
	ROWTERMINATOR = '\n'
	)
	
	

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of openshac
openshac

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial