473,404 Members | 2,187 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

run SQL stored procedure from Excel

17
Hi,

I need to run a SQL Server 2005 stored procedure by pressing a command button in excel 2003 (VisualBasic 6.3).

Searched and tried many solutions here and in other web resources, read about opening the datasource, but I cannot find the exact solution for my problem.

Any help would be greatly appreciated,

Thanks
Jan 3 '08 #1
2 2708
Hi,

I need to run a SQL Server 2005 stored procedure by pressing a command button in excel 2003 (VisualBasic 6.3).

Searched and tried many solutions here and in other web resources, read about opening the datasource, but I cannot find the exact solution for my problem.

Any help would be greatly appreciated,

Thanks
I hope that I understad your problem correctly and that this will help:

You must first connect to the DB.

Use VB Code something like this in design view in Excel:

Vcmp.Server = "CENTURIONDC"
Vcmp.CompanyDB = "AS_TSH_PRD"
Vcmp.UserName = InputBox("Enter your user name", "User Name")
Vcmp.Password = InputBox("Enter your password", "Password")
Vcmp.DbUserName = "sa"
Vcmp.DbPassword = "salerta"
Vcmp.Language = ln_English
Vcmp.UseTrusted = False
rt = Vcmp.Connect()

Debug.Print "Connect result:"; rt

Remember the references must be added by using Tools > References... and Vcmp must be declared by using your references.

When connected, you can retrieve data or post data to the DB.

Regards
Jan 3 '08 #2
ck9663
2,878 Expert 2GB
a very useful link:

http://www.connectionstrings.com/

-- CK
Jan 3 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: james cox via SQLMonster.com | last post by:
I don't know if this is possible. However, what i am attempting to do is using C#'s window forms. I open up an excell sheet stored in my windows form. The excel sheet stores names of the stored...
22
by: M K | last post by:
Heres my SP: ( i am trying to add more than 1 field but get the same error no matter how many i try to add, i thought i would try to insert the primary key only and work up from there but the...
0
by: franjorge | last post by:
Hi, I have created two stored procedures via VB using this code: sql = "CREATE PROC " & nombre_proc & " AS SELECT *" & _ " From MBM_PUNTOS_SCE_SIN_COINCIDIR_SIEGE_FALTA_PM_NE_" & mes & _ "...
3
by: ABC | last post by:
What methods can export excel file from stored procedure with parameters which input from web form?
0
by: Paul | last post by:
Hi I have a simple stored procedure shown below and am trying to use it in a ..net window application to fill a dataset. IT works out of query analyzer, returns data from an excel file. Anyhow in...
3
dbushcmohle
by: dbushcmohle | last post by:
Hello, I am having problems exporting a stored procedure's results to an Excel file... I've done this many times successfully, but never had to introduce a variable. Now that I've introduced...
7
by: flickimp | last post by:
Hi I want to create a Stored Procedure in SQL with three variables that are declared in an Excel file. Thus, when the user enters the three variables into Cells A1, B1, C1 Then hits a...
1
by: flickimp | last post by:
Hi I have a stored procedure on SQL Server 2000 called: .Capacity_Planning.dbo.sp_flickimp_test I have an Excel Sheet with the 2 paramters for the Stored procedure in cells A1 and B1. How...
1
by: seyyadri | last post by:
Hi, I want the data in excel, pulled from SQL server stored procedure. The SQL SP has the parameters. when we open/refresh the excel it should prompt the user to enter the parameters (dynamically),...
4
code green
by: code green | last post by:
Within a stored procedure I am creating a table from an Excel spreadsheet /*Create tmp table from XLS*/ SELECT * INTO tmp_cons FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0','Excel 8.0;...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.