How Do You Pass input parameters to a Stored Procedure Using an ASP Input Screen?

  • Once you get the connection string working, you can totally skip the command object. However, there are times you need it so if you are in a learnng exercise, great. I find the 'stored proc name as a method' approach is extremely fast (see my previous post).

    However, I was looking at your stored proc just now. You wrote:

    CREATE  PROCEDURE prAddItem  (@Firstname nvarchar, @LastName nvarchar) AS

    INSERT INTO WOCS.dbo.Students (Firstname, Lastname) VALUES ('"& @Firstname @Lastname"')

    I'd be tempted to say it has a problem (quotes in the VALUES clause)

    should read something like:

    CREATE PROCEDURE prAddItem

       @FirstName varchar(100),

       @LastName varchar(100)

    AS

    SET NOCOUNT ON

    INSERT INTO WOCS.dbo.Students(FirstName, LastName)

    VALUES (@FirstName, @LastName)

    SET NOCOUNT OFF

    Hope this helps

     

     

     

Viewing post 16 (of 15 total)

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