sending a variable to sp

  • hi,

    i want to send a variable to sp from vb6.

    CREATE PROCEDURE dbo.AddNewRec

    (

    @T_CID int,

    @T_DeadLine int

    )

    AS

    INSERT INTO tblRequest

    (

    T_CID,

    T_Date,

    T_DeadLine

    )

    VALUES

    (

    @T_CID,

    GETDATE(),

    GETDATE() + 30 minutes ???????????

    )

    GO

    iwant to fill T_DeadLine field with the value of GETDATE() + anyMin ( ill send this anyMin from my vb app)

    how can i send minute to sp?

    thanx all.

     

  • You can do a different approach to this

    Pass the minutes in a parameter. with the use of DateADD function u can insert the nesseray time into the table




    My Blog: http://dineshasanka.spaces.live.com/

  • yes refer to bol you can use the DATEADD ( datepart , number, date ) function.

    hope you know how to run a stored proc from vb 6


    Everything you can imagine is real.

  • Do a SP in SQL 2000 and from VB use ADODB.CONNECTION and ADODB.COMMAND objects.


    Kindest Regards,

    Vasc

  • change your sp Like this..

    CREATE PROCEDURE dbo.AddNewRec

    (

    @T_CID int,

    @T_DeadLine int

    )

    AS

    INSERT INTO tblRequest

    (

    T_CID,

    T_Date,

    T_DeadLine

    )

    VALUES

    (

    @T_CID,

    GETDATE(),

    DateAdd(n,30,GETDATE() )

    )

    GO

    IN VB do the Following Steps

    1) Create a Connection Object and Set the Connection string And Open the connection

    2) Create a command Object, Set the Connection property and CommandText Property.

    3) Create 2 parameter object for SP Parameters,

    4) Add the paremeters to the Paramaters Collection property of the command object.

    5) Execute the Command.

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply