insert record using stored proc returns no error but doesn't inserd record

Discussion in 'ASP General' started by Guest, Jan 8, 2004.

  1. Guest

    Guest Guest

    Hi

    I am using SQL server 7.0 and here is my code:

    Dim conn
    set conn = Server.CreateObject("ADODB.Connection")
    conn.open "websql"

    If conn.state=adStateOpen then
    Response.Write("ConnMade : " & conn.state
    & "<BR>")
    Response.flush
    else
    Response.Write("not ConnMade : " &
    conn.state & "<BR>")
    end if
    'response.write sql
    conn.execute("Insert_Emailseller" &_
    " @fname='" & fname & "'," &_
    " @lname='" & lname & "'," &_
    " @dphone='" & dphone & "'," &_
    " @ephone='" & ephone & "'," &_
    " @email='" & email & "'," &_
    " @comments='" & comments & "'," &_
    " @chktrade='" & chktrade & "'," &_
    " @chkfinance='" & chkfinance & "'," &_
    " @ctime='" & ctime & "'," &_
    " @prom='" & prom & "'," &_
    " @dealerid='" & dealerid & "'," &_
    " @vin='" & vin & "'," &_
    " @dateandtime=" & dateandtime)
    'conn.ExecuteComplete(sql)
    'Response.write("Record inserted. ID number was <b>" &
    rs(0) & "</b>.")
    'rs.close: set rs = nothing
    conn.close: set conn = nothing

    and my stored procedure is:
    CREATE PROCEDURE dbo.Insert_Emailseller

    @fname varchar (50) ,
    @lname varchar (50) ,
    @dphone int ,
    @ephone int ,
    @email varchar (50) ,
    @comments text ,
    @chktrade bit ,
    @chkfinance bit ,
    @ctime char (10) ,
    @prom tinyint ,
    @dealerid char (10) ,
    @vin varchar (18) ,
    @dateandtime datetime
    AS
    BEGIN
    SET NOCOUNT ON
    DECLARE @new_emailseller INT
    INSERT caremail_leads
    (
    fname ,
    lname ,
    dphone ,
    ephone ,
    email ,
    comments ,
    chktrade ,
    chkfinance ,
    ctime ,
    prom ,
    dealerid ,
    vin ,
    dateandtime
    )
    VALUES
    (
    @fname ,
    @lname ,
    @dphone ,
    @ephone ,
    @email ,
    @comments ,
    @chktrade ,
    @chkfinance ,
    @ctime ,
    @prom ,
    @dealerid ,
    @vin ,
    @dateandtime
    )
    SELECT @new_emailseller = @@IDENTITY
    SELECT new_emailseller = @new_emailseller
    END
    Guest, Jan 8, 2004
    #1
    1. Advertising

  2. Guest

    Alex G Guest

    Shouldn't the stored procedure be using INSERT INTO not just INSERT ??

    <> wrote in message news:<046001c3d622$e9fc6410$>...
    > Hi
    >
    > I am using SQL server 7.0 and here is my code:
    >
    > Dim conn
    > set conn = Server.CreateObject("ADODB.Connection")
    > conn.open "websql"
    >
    > If conn.state=adStateOpen then
    > Response.Write("ConnMade : " & conn.state
    > & "<BR>")
    > Response.flush
    > else
    > Response.Write("not ConnMade : " &
    > conn.state & "<BR>")
    > end if
    > 'response.write sql
    > conn.execute("Insert_Emailseller" &_
    > " @fname='" & fname & "'," &_
    > " @lname='" & lname & "'," &_
    > " @dphone='" & dphone & "'," &_
    > " @ephone='" & ephone & "'," &_
    > " @email='" & email & "'," &_
    > " @comments='" & comments & "'," &_
    > " @chktrade='" & chktrade & "'," &_
    > " @chkfinance='" & chkfinance & "'," &_
    > " @ctime='" & ctime & "'," &_
    > " @prom='" & prom & "'," &_
    > " @dealerid='" & dealerid & "'," &_
    > " @vin='" & vin & "'," &_
    > " @dateandtime=" & dateandtime)
    > 'conn.ExecuteComplete(sql)
    > 'Response.write("Record inserted. ID number was <b>" &
    > rs(0) & "</b>.")
    > 'rs.close: set rs = nothing
    > conn.close: set conn = nothing
    >
    > and my stored procedure is:
    > CREATE PROCEDURE dbo.Insert_Emailseller
    >
    > @fname varchar (50) ,
    > @lname varchar (50) ,
    > @dphone int ,
    > @ephone int ,
    > @email varchar (50) ,
    > @comments text ,
    > @chktrade bit ,
    > @chkfinance bit ,
    > @ctime char (10) ,
    > @prom tinyint ,
    > @dealerid char (10) ,
    > @vin varchar (18) ,
    > @dateandtime datetime
    > AS
    > BEGIN
    > SET NOCOUNT ON
    > DECLARE @new_emailseller INT
    > INSERT caremail_leads
    > (
    > fname ,
    > lname ,
    > dphone ,
    > ephone ,
    > email ,
    > comments ,
    > chktrade ,
    > chkfinance ,
    > ctime ,
    > prom ,
    > dealerid ,
    > vin ,
    > dateandtime
    > )
    > VALUES
    > (
    > @fname ,
    > @lname ,
    > @dphone ,
    > @ephone ,
    > @email ,
    > @comments ,
    > @chktrade ,
    > @chkfinance ,
    > @ctime ,
    > @prom ,
    > @dealerid ,
    > @vin ,
    > @dateandtime
    > )
    > SELECT @new_emailseller = @@IDENTITY
    > SELECT new_emailseller = @new_emailseller
    > END
    Alex G, Jan 9, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. David Lozzi
    Replies:
    3
    Views:
    1,920
    David Lozzi
    Jun 1, 2005
  2. NevilleDNZ
    Replies:
    9
    Views:
    428
    NevilleDNZ
    Aug 16, 2006
  3. bogdan
    Replies:
    3
    Views:
    548
    bruce barker
    Apr 8, 2008
  4. Jean-Hugues ROBERT

    Why no Proc##[]=() ? Why no Proc##replace() ?

    Jean-Hugues ROBERT, May 1, 2004, in forum: Ruby
    Replies:
    14
    Views:
    271
    Jean-Hugues ROBERT
    May 5, 2004
  5. Minkoo Seo

    Proc vs lambda vs proc

    Minkoo Seo, Feb 4, 2007, in forum: Ruby
    Replies:
    19
    Views:
    232
    Brian Candler
    Feb 6, 2007
Loading...

Share This Page