Solved

How to call a sql server procedure from within vb6?

Posted on 2008-10-27
4
217 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
ID: 22811279

' 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
ID: 22811312
0
 

Author Comment

by:Schuttend
ID: 22816319
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
ID: 22817002
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

911 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

21 Experts available now in Live!

Get 1:1 Help Now