Solved

How to call a sql server procedure from within vb6?

Posted on 2008-10-27
4
221 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

737 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