469,306 Members | 1,881 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,306 developers. It's quick & easy.

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

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
Jul 19 '05 #1
1 1682
Shouldn't the stored procedure be using INSERT INTO not just INSERT ??

<an*******@discussions.microsoft.com> wrote in message news:<04****************************@phx.gbl>...
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

Jul 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Tavish Muldoon | last post: by
1 post views Thread by Max | last post: by
4 posts views Thread by Dabbler | last post: by
reply views Thread by mirandacascade | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by harlem98 | last post: by
reply views Thread by harlem98 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.