Hi -
I want to write the stored procedure that insert the data into the sql server table. There is a vb.net code that returns the parameter value for stored procedure and I want to pass that parameter into insert statement to insert the row into the table.
e.g,
Create proc InsertDemo
(@p_p1 int, @p_p2 int, @p_p3 int, @p_p4 varchar(20),@p_p5 datetime)
begin
insert into xtable
(F1,F2,F3,F4,F5)
values ()
end
so, here I am going to call this proc from within the vb.net code so. parameter values will come from vb.net code and I want to add those parameter values into the 'xtable'
how can i do that?
one way I can think of like
create proc InsertDemo
(@p_p1 int, @p_p2 int, @p_p3 int, @p_p4 varchar(20),@p_p5 datetime)
begin
declare @v_p1 int
declare @v_p2 int
declare @v_p3 int
declare @v_p4 varchar(20)
declare @v_p5 datetime
set @v_p1 = @p_p1
set @v_p2 = @p_p2
set @v_p3 = @p_p3
....
set @v_p5 =@p_p5
Insert into xTable
(F1,F2,F3,F4,F5)
values (@v_p1,@v_p2....@v_p5)
but I don't think so that I can assing parameter values to the variable.
So, how can i accomplish this in this scenario?
Thanks.