473,322 Members | 1,232 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

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 1778
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Tavish Muldoon | last post by:
What a pain trying to insert data into a table from a stored proc. My webform asks for 16 pieces of data - which then gets written to the database. I found this easier than the crap below...
16
by: LP | last post by:
Hi, Every morning a .NET application downloads a file with cumulative data which needs to be appended to SQL Server table. This program needs to identify records that have not been previously...
1
by: Max | last post by:
I'm looking for best methods in terms of performance and simplicity to do an INSERT and UPDATE. Using Microsoft's Application Blocks and SQL Server stored procedures, this is simple: Insert:...
3
by: ASP .NET Newbie | last post by:
I am trying to insert a new record into my database, and have it return a uniqueidentifier as the "newcatid". I don't use integers as my "id"'s, but rather uniqueidentifiers. Here's my Stored...
6
by: SandySears | last post by:
I am trying to use a stored procedure to insert a record using VS 2005, VB and SQL Server Express. The code runs without errors or exceptions, and returns the new identifer in the output...
4
by: Dabbler | last post by:
I'm using an SQLCommand to insert row using a text command. Is there a way to return the IDENTITY key value after the insert ? Thanks much!
3
by: Tim Satterwhite | last post by:
Hi All, I think this is a thorny problem, and I'm hoping you can help. I've not found this exact issue described anywhere yet. I have a stored procedure that calls BULK INSERT on a set of...
4
by: ryushinyama | last post by:
I had to do a lot of searching to get this one to work and in doing so I saw a lot of different sites where people were looking for this answer so I thought I would put it up. If you are trying...
0
by: mirandacascade | last post by:
Questions toward the bottom of the post. Situation is this: 1) Access 97 2) SQL Server 2000 3) The Access app: a) sets up pass-thru query b) .SQL property of querydef is a string, the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.