Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Passing parameters

Author  Topic 

Jirib
Starting Member

5 Posts

Posted - 2005-06-03 : 09:48:05
guys i found out how to show my stored procedures in a grid in Visual Basic already... but those Stored procedures already have values... and i want to get the parameters from the user to execute the stored procedure....

CREATE PROCEDURE sp_procedimiento @Sucursal varchar(3), @deposito varchar(3)
AS
select tablsucu.CodSuc,tabldepo.CodDep, tablsucu.desSuc
from tablsucu,tabldepo,tablruta
where tablsucu.codsuc = @Sucursal
and tabldepo.coddep = @deposito
and tablsucu.codsuc = tabldepo.codsuc
and tabldepo.coddep = tablruta.coddep
GO

heres my Stored procedure and i want from Visual Basic receive of the user the values of @Sucursal and @deposito

if anyone can help with that

Thx

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-06-03 : 10:03:46
con.Execute("sp_procedimiento 'param1','param2'")
where con is the connection object

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

Jirib
Starting Member

5 Posts

Posted - 2005-06-03 : 10:24:50
Still dont work like that it says that the @rute is not defined or something like that....

this is the code i have in VB

Cn.Execute ("sp_prueba155 '000002','01010102'")
Rs.Open "sp_prueba155", strConex, adOpenStatic, adLockReadOnly

and this is the error it gives to me... it says in english like this... the Procedure precise a parameter '@rute' is not specified or something like that... im a noob at english tho


Go to Top of Page

Jirib
Starting Member

5 Posts

Posted - 2005-06-03 : 11:08:57
ok now all i did is

Cn.Execute ("exec sp_prueba155 '000002','01010102'")
Rs.Open ("exec sp_prueba155 '000002','01010102'"), strConex, adOpenStatic, adLockReadOnly


and it worked.... dunno still why i have to make exec in .execute and also .open weird huh
Go to Top of Page
   

- Advertisement -