Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: Still doesnt work Addnew Recordset


Message #1 by "Brad Libby" <libby_brad@b...> on Tue, 26 Sep 2000 14:34:54 +0100
I enclosed it in quotes and it still didnt work... returns the same error

on the same line...



<!-- metadata type = "typelib"

				file = "c:\program files\common files\system\ado\msado15.dll" -->

<% if session("sell")<> true then

response.redirect "index.asp"

else%>

<%

username = request.form("username")

title = request.form("title")

category=request.form("category")

description=request.form("description")

quantity=request.form("quantity")

uploadpic=request.form("uploadpic")

itemlocation=request.form("itemlocation")

webpage=request.form("webpage")

duration=request.form("duration")

reserve=request.form("reserve")

minbid=request.form("minbid")

payment=request.form("payment")

finalcost=request.form("finalcost")

shipping=request.form("shipping")

bold=request.form("bold")

highlight=request.form("highlight")

featured=request.form("featured")

catfeatured=request.form("catfeatured")

submitdate = FormatDateTime(Date, 1) 

datenow = FormatDateTime(Date)

enddate = DateAdd("d", duration, datenow)

submittime = FormatDateTime(Now, 3)





dim objrs, strconnect, strcriteria

strconnect = "DRIVER={SQL

Server};SERVER=sqldata;LANGUAGE=us_english;DATABASE=motorbrain;UID=motorbrain;PWD=kristie"



set objrs = server.createobject("adodb.recordset")

objrs.open "users", strconnect, adopendynamic, adlockoptimistic

objrs.addnew

objrs("seller") = username 'error here

objrs("title") = title

objrs("category") = category

objrs("description") = description

objrs("quantity") = quantity

objrs("haspic") = uploadpic

objrs("sellerlocation") = itemlocation

objrs("haslink") = webpage

objrs("length") = duration

objrs("reserve") = reserve

objrs("minbid") = minbid

objrs("payment") = payment

objrs("totalprice") = finalcost

objrs("shipping") = shipping

objrs("bold") = bold

objrs("highlight") = highlight

objrs("homefeatured") = featured

objrs("catfeatured") = catfeatured

objrs("submitdate") = submitdate

objrs("enddate") = enddate

objrs("submittime") = submittime

objrs.update



objrs.close

set objrs = nothing

%>



Thanks

Brad

Message #2 by Imar Spaanjaars <Imar@S...> on Tue, 26 Sep 2000 16:29:25 +0200
Weird. It should work, because the code is OK.



Are you opening the right table?? Is there a column called seller in the 

Users table?

I think the problem must be somewhere in that area, because the code looks 

OK to me.



What error do you receive exactly?





Imar





At 02:34 PM 9/26/2000 +0100, you wrote:

>I enclosed it in quotes and it still didnt work... returns the same error

>on the same line...

>

><!-- metadata type = "typelib"

>                                 file = "c:\program files\common 

> files\system\ado\msado15.dll" -->

><% if session("sell")<> true then

>response.redirect "index.asp"

>else%>

><%

>username = request.form("username")

>title = request.form("title")

>category=request.form("category")

>description=request.form("description")

>quantity=request.form("quantity")

>uploadpic=request.form("uploadpic")

>itemlocation=request.form("itemlocation")

>webpage=request.form("webpage")

>duration=request.form("duration")

>reserve=request.form("reserve")

>minbid=request.form("minbid")

>payment=request.form("payment")

>finalcost=request.form("finalcost")

>shipping=request.form("shipping")

>bold=request.form("bold")

>highlight=request.form("highlight")

>featured=request.form("featured")

>catfeatured=request.form("catfeatured")

>submitdate = FormatDateTime(Date, 1)

>datenow = FormatDateTime(Date)

>enddate = DateAdd("d", duration, datenow)

>submittime = FormatDateTime(Now, 3)

>

>

>dim objrs, strconnect, strcriteria

>strconnect = "DRIVER={SQL

>Server};SERVER=sqldata;LANGUAGE=us_english;DATABASE=motorbrain;UID=motorbra 

>in;PWD=kristie"

>

>set objrs = server.createobject("adodb.recordset")

>objrs.open "users", strconnect, adopendynamic, adlockoptimistic

>objrs.addnew

>objrs("seller") = username 'error here

>objrs("title") = title

>objrs("category") = category

>objrs("description") = description

>objrs("quantity") = quantity

>objrs("haspic") = uploadpic

>objrs("sellerlocation") = itemlocation

>objrs("haslink") = webpage

>objrs("length") = duration

>objrs("reserve") = reserve

>objrs("minbid") = minbid

>objrs("payment") = payment

>objrs("totalprice") = finalcost

>objrs("shipping") = shipping

>objrs("bold") = bold

>objrs("highlight") = highlight

>objrs("homefeatured") = featured

>objrs("catfeatured") = catfeatured

>objrs("submitdate") = submitdate

>objrs("enddate") = enddate

>objrs("submittime") = submittime

>objrs.update

>

>objrs.close

>set objrs = nothing

>%>

>

>Thanks

>Brad

>

>---

>To place your message here, or to sponsor this list, please e-mail 

>mailto:p2pinfo@w...?subject=MediaPack, remembering to provide contact 

>details for yourself. We will e-mail you a Media Pack within 24 hours.

>

>You are currently subscribed to asp_databases


>---





Message #3 by Yoram Zehavi <YoramZ@i...> on Tue, 26 Sep 2000 17:25:55 +0200
insted of "session("sell")<> true" write 'if not session("sell")'

insted of request.form("...") use request("...")



it's should work



-----Original Message-----

From: Brad Libby [mailto:libby_brad@b...]

Sent: Tuesday, September 26, 2000 3:35 PM

To: ASP Databases

Subject: [asp_databases] Still doesnt work Addnew Recordset





I enclosed it in quotes and it still didnt work... returns the same error

on the same line...



<!-- metadata type = "typelib"

				file = "c:\program files\common

files\system\ado\msado15.dll" -->

<% if session("sell")<> true then

response.redirect "index.asp"

else%>

<%

username = request.form("username")

title = request.form("title")

category=request.form("category")

description=request.form("description")

quantity=request.form("quantity")

uploadpic=request.form("uploadpic")

itemlocation=request.form("itemlocation")

webpage=request.form("webpage")

duration=request.form("duration")

reserve=request.form("reserve")

minbid=request.form("minbid")

payment=request.form("payment")

finalcost=request.form("finalcost")

shipping=request.form("shipping")

bold=request.form("bold")

highlight=request.form("highlight")

featured=request.form("featured")

catfeatured=request.form("catfeatured")

submitdate = FormatDateTime(Date, 1) 

datenow = FormatDateTime(Date)

enddate = DateAdd("d", duration, datenow)

submittime = FormatDateTime(Now, 3)





dim objrs, strconnect, strcriteria

strconnect = "DRIVER={SQL

Server};SERVER=sqldata;LANGUAGE=us_english;DATABASE=motorbrain;UID=motorbrai

n;PWD=kristie"



set objrs = server.createobject("adodb.recordset")

objrs.open "users", strconnect, adopendynamic, adlockoptimistic

objrs.addnew

objrs("seller") = username 'error here

objrs("title") = title

objrs("category") = category

objrs("description") = description

objrs("quantity") = quantity

objrs("haspic") = uploadpic

objrs("sellerlocation") = itemlocation

objrs("haslink") = webpage

objrs("length") = duration

objrs("reserve") = reserve

objrs("minbid") = minbid

objrs("payment") = payment

objrs("totalprice") = finalcost

objrs("shipping") = shipping

objrs("bold") = bold

objrs("highlight") = highlight

objrs("homefeatured") = featured

objrs("catfeatured") = catfeatured

objrs("submitdate") = submitdate

objrs("enddate") = enddate

objrs("submittime") = submittime

objrs.update



objrs.close

set objrs = nothing

%>



Thanks

Brad



---

To place your message here, or to sponsor this list, please e-mail

mailto:p2pinfo@w...?subject=MediaPack, remembering to provide contact

details for yourself. We will e-mail you a Media Pack within 24 hours.



You are currently subscribed to asp_databases 


---

Message #4 by "David E" <registerukh@h...> on Tue, 26 Sep 2000 11:04:22 EDT
The following is just my guess.

Probably we may have use INSERT SQL statement (with each field name and its 

value typed out) and then execute the connection or command object instead 

of using ADDNEW and UPDATE.

What's happening, I guess, is when we use ADDNEW, the database is expecting 

all the fields to be there including the AUTONUMBER one.

Again this is my guess work.

BTW, could you please add adCmdTable as the option while opening the 

Recordset as it would speed up the app a bit.









>From: "Brad Libby" <libby_brad@b...>

>Reply-To: "ASP Databases" <asp_databases@p...>

>To: "ASP Databases" <asp_databases@p...>

>Subject: [asp_databases] Still doesnt work Addnew Recordset

>Date: Tue, 26 Sep 2000 14:34:54 +0100

>I am trying to insert data into a table via recordsets. the SQL 7.0 table

has an "id" column that AutoNumbers when a new record is inserted. he is

the code the session at the top make sure the user is logged in..





>I enclosed it in quotes and it still didnt work... returns the same error

>on the same line...

>

><!-- metadata type = "typelib"

>				file = "c:\program files\common files\system\ado\msado15.dll" -->

><% if session("sell")<> true then

>response.redirect "index.asp"

>else%>

><%

>username = request.form("username")

>title = request.form("title")

>category=request.form("category")

>description=request.form("description")

>quantity=request.form("quantity")

>uploadpic=request.form("uploadpic")

>itemlocation=request.form("itemlocation")

>webpage=request.form("webpage")

>duration=request.form("duration")

>reserve=request.form("reserve")

>minbid=request.form("minbid")

>payment=request.form("payment")

>finalcost=request.form("finalcost")

>shipping=request.form("shipping")

>bold=request.form("bold")

>highlight=request.form("highlight")

>featured=request.form("featured")

>catfeatured=request.form("catfeatured")

>submitdate = FormatDateTime(Date, 1)

>datenow = FormatDateTime(Date)

>enddate = DateAdd("d", duration, datenow)

>submittime = FormatDateTime(Now, 3)

>

>

>dim objrs, strconnect, strcriteria

>strconnect = "DRIVER={SQL

>Server};SERVER=sqldata;LANGUAGE=us_english;DATABASE=motorbrain;UID=motorbrain;PWD=kristie"

>

>set objrs = server.createobject("adodb.recordset")

>objrs.open "users", strconnect, adopendynamic, adlockoptimistic

>objrs.addnew

>objrs("seller") = username 'error here

>objrs("title") = title

>objrs("category") = category

>objrs("description") = description

>objrs("quantity") = quantity

>objrs("haspic") = uploadpic

>objrs("sellerlocation") = itemlocation

>objrs("haslink") = webpage

>objrs("length") = duration

>objrs("reserve") = reserve

>objrs("minbid") = minbid

>objrs("payment") = payment

>objrs("totalprice") = finalcost

>objrs("shipping") = shipping

>objrs("bold") = bold

>objrs("highlight") = highlight

>objrs("homefeatured") = featured

>objrs("catfeatured") = catfeatured

>objrs("submitdate") = submitdate

>objrs("enddate") = enddate

>objrs("submittime") = submittime

>objrs.update

>

>objrs.close

>set objrs = nothing

>%>

>

>Thanks

>Brad

>

Message #5 by "David E" <registerukh@h...> on Tue, 26 Sep 2000 11:05:59 EDT
<Contd>

If you are using INSERT then you dont have to mention the AUTONUMBER field 

in the SQL statement which I forgot to mention in my previous mail.



Hope this works.









>From: "Brad Libby" <libby_brad@b...>

>Reply-To: "ASP Databases" <asp_databases@p...>

>To: "ASP Databases" <asp_databases@p...>

>Subject: [asp_databases] Still doesnt work Addnew Recordset

>Date: Tue, 26 Sep 2000 14:34:54 +0100

>

>I enclosed it in quotes and it still didnt work... returns the same error

>on the same line...

>

><!-- metadata type = "typelib"

>				file = "c:\program files\common files\system\ado\msado15.dll" -->

><% if session("sell")<> true then

>response.redirect "index.asp"

>else%>

><%

>username = request.form("username")

>title = request.form("title")

>category=request.form("category")

>description=request.form("description")

>quantity=request.form("quantity")

>uploadpic=request.form("uploadpic")

>itemlocation=request.form("itemlocation")

>webpage=request.form("webpage")

>duration=request.form("duration")

>reserve=request.form("reserve")

>minbid=request.form("minbid")

>payment=request.form("payment")

>finalcost=request.form("finalcost")

>shipping=request.form("shipping")

>bold=request.form("bold")

>highlight=request.form("highlight")

>featured=request.form("featured")

>catfeatured=request.form("catfeatured")

>submitdate = FormatDateTime(Date, 1)

>datenow = FormatDateTime(Date)

>enddate = DateAdd("d", duration, datenow)

>submittime = FormatDateTime(Now, 3)

>

>

>dim objrs, strconnect, strcriteria

>strconnect = "DRIVER={SQL

>Server};SERVER=sqldata;LANGUAGE=us_english;DATABASE=motorbrain;UID=motorbrain;PWD=kristie"

>

>set objrs = server.createobject("adodb.recordset")

>objrs.open "users", strconnect, adopendynamic, adlockoptimistic

>objrs.addnew

>objrs("seller") = username 'error here

>objrs("title") = title

>objrs("category") = category

>objrs("description") = description

>objrs("quantity") = quantity

>objrs("haspic") = uploadpic

>objrs("sellerlocation") = itemlocation

>objrs("haslink") = webpage

>objrs("length") = duration

>objrs("reserve") = reserve

>objrs("minbid") = minbid

>objrs("payment") = payment

>objrs("totalprice") = finalcost

>objrs("shipping") = shipping

>objrs("bold") = bold

>objrs("highlight") = highlight

>objrs("homefeatured") = featured

>objrs("catfeatured") = catfeatured

>objrs("submitdate") = submitdate

>objrs("enddate") = enddate

>objrs("submittime") = submittime

>objrs.update

>

>objrs.close

>set objrs = nothing

>%>

>

>Thanks

>Brad

>

Message #6 by Imar Spaanjaars <Imar@S...> on Tue, 26 Sep 2000 18:13:52 +0200
You are right about the benefits of the SQL statements. It performs a lot 

faster. However, if I recall correctly, Brad mentioned a specific reason 

for using addNew.



Brad.... what was that reason again?? Why not use a SQL statment?? ;-)



Imar









At 11:04 AM 9/26/2000 -0400, you wrote:

>The following is just my guess.

>Probably we may have use INSERT SQL statement (with each field name and 

>its value typed out) and then execute the connection or command object 

>instead of using ADDNEW and UPDATE.

>What's happening, I guess, is when we use ADDNEW, the database is 

>expecting all the fields to be there including the AUTONUMBER one.

>Again this is my guess work.

>BTW, could you please add adCmdTable as the option while opening the 

>Recordset as it would speed up the app a bit.

>





Message #7 by "David E" <registerukh@h...> on Tue, 26 Sep 2000 15:00:22 EDT
Imar,



I dont think I ever said we should use SQL for speeding up the apps. Please 

refer to the threads if you want, instead of asking me back what did I say 

;-)



I would have really appreciated you if you by yourself posted what Brad had 

said.



I was just mentioning what my view was and not trying to impose anything on 

anybody.



Hope this clears your confusion. If you are still confused, please mail me 

off this list and we can talk.



Thanks









>From: Imar Spaanjaars <Imar@S...>

>Reply-To: "ASP Databases" <asp_databases@p...>

>To: "ASP Databases" <asp_databases@p...>

>Subject: [asp_databases] Re: Still doesnt work Addnew Recordset

>Date: Tue, 26 Sep 2000 18:13:52 +0200

>

>You are right about the benefits of the SQL statements. It performs a lot

>faster. However, if I recall correctly, Brad mentioned a specific reason

>for using addNew.

>

>Brad.... what was that reason again?? Why not use a SQL statment?? ;-)

>

>Imar

>

>

>

>

>At 11:04 AM 9/26/2000 -0400, you wrote:

>>The following is just my guess.

>>Probably we may have use INSERT SQL statement (with each field name and

>>its value typed out) and then execute the connection or command object

>>instead of using ADDNEW and UPDATE.

>>What's happening, I guess, is when we use ADDNEW, the database is

>>expecting all the fields to be there including the AUTONUMBER one.

>>Again this is my guess work.

>>BTW, could you please add adCmdTable as the option while opening the

>>Recordset as it would speed up the app a bit.

>>

>

>

>


  Return to Index