Solved

How to call a sql server procedure from within vb6?

Posted on 2008-10-27
4
215 Views
Last Modified: 2010-05-03
Hello,

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

Regards,
Dennis
0
Comment
Question by:Schuttend
  • 2
4 Comments
 
LVL 6

Expert Comment

by:openshac
Comment Utility

' 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

0
 
LVL 1

Expert Comment

by:RSHAH03
Comment Utility
0
 

Author Comment

by:Schuttend
Comment Utility
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

0
 
LVL 6

Accepted Solution

by:
openshac earned 125 total points
Comment Utility
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now