 |
| Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

March 16th, 2005, 05:47 AM
|
|
Authorized User
|
|
Join Date: Apr 2004
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
UPDATE CURRENT RECORD
I HAVE A TABLE ITEM WITH ITEM_NO,ITEM_NAME,ITEM_STATUS_NO
I HAVE TO UPDATE ITEM_STATUS_NO BY SELECTING ONE BY ONE IN A LOOP WHAT THE PROBLEM IS IT GIVES ME ERROR CANNOT UPDATE CURRENT RECORD BECAUSE OF CONNECTION TYPE OR lOCKTYPE. INTIALLY SAME CODE WAS REUNNIG ON ms acceSS BUT IT IS NOT RUNNIG ON sQL SERVER
THE cONNETION TYPE IS
CNN IN A SONNECTION STRING USED TO CONNECT THE DATABASE mS sQL
DIM STRSQL
DIM CNN
DIM RST
SET CNN = SERVER.cREATEOBJECT("ADODB.cONNECTION")
SET RST = sERVER.CREATEOBJECT("ADODB.rECORDSET")
SET CNN = SERVER.CREATEOBJECT("aDODB.cONNECTION")
STRSQL = "SELECT * FROM ITEM"
RST.OPEN STRSQL,CNN, ADOPENKEYSET,ADLOCKOPTIMISTIC
DO WHILE NOT RST.EOF
RST("ITEM_STAUS_NO") = NYMBER23
RST.UPDATE
LOOP
WHAT IS WRONG I DONT KNOW
dinesh Rana
__________________
dinesh Rana
|
|

March 16th, 2005, 12:38 PM
|
|
Friend of Wrox
|
|
Join Date: Jan 2004
Posts: 303
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Code you have posted I do not see that you have established connection to your db
Dim Conn
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open("Your Connection String")
If you are using SQL Server then something like this
Conn.Open("Provider=sqloledb;Data Source=Aron1;Initial Catalog=pubs;User Id=sa;Password=asdasd;")
|
|

March 17th, 2005, 12:58 AM
|
|
Authorized User
|
|
Join Date: Apr 2004
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Sorry i forgoten to write it in the code here yes i have made connection
application("cnstring")= "Provider=sqloledb;" & _
"Data Source=hopeone;" & _
"Initial Catalog=diert;" & _
"Integrated Security=SSPI;"
and the same is given in the Global.asa and is used to call it like
cnn.open application("cnstring")
know the complete code is
DIM STRSQL
DIM CNN
DIM RST
SET CNN = SERVER.cREATEOBJECT("ADODB.cONNECTION")
SET RST = sERVER.CREATEOBJECT("ADODB.rECORDSET")
SET CNN = SERVER.CREATEOBJECT("aDODB.cONNECTION")
cnn.open application("cnstring")
STRSQL = "SELECT * FROM ITEM"
RST.OPEN STRSQL,CNN, ADOPENKEYSET,ADLOCKOPTIMISTIC
DO WHILE NOT RST.EOF
RST("ITEM_STAUS_NO") = NYMBER23
RST.UPDATE
LOOP
WHAT IS WRONG I DONT KNOW
dinesh Rana
|
|

March 17th, 2005, 04:03 AM
|
|
Authorized User
|
|
Join Date: Aug 2003
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
try this:
rst.open strsql, cnn, adopenstatic, adlockpessimistic
Regards,
Sherief C. Mursyidi
|
|

March 17th, 2005, 05:32 AM
|
|
Authorized User
|
|
Join Date: Apr 2004
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
no
rst.open strsql, cnn, adopenstatic, adlockpessimistic
this does not works as the arguments are conflicting with each other
dinesh Rana
|
|

March 17th, 2005, 12:16 PM
|
|
Friend of Wrox
|
|
Join Date: Jan 2004
Posts: 303
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Are you including adovbs.inc in your code?
Response.Write your SQL statement
RST.OPEN STRSQL,CNN, ADOPENKEYSET,ADLOCKOPTIMISTIC
Response.Write(strSQL)
and post the exact error message you are receiving in this forum
|
|

March 18th, 2005, 02:22 AM
|
|
Authorized User
|
|
Join Date: Apr 2004
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
the exact error is
Error Type:
ADODB.Recordset (0x800A0CB3)
Current Recordset does not support updating. This may be a limitation of the provider, or of the selected locktype.
yes i included adovbs.inc
dinesh Rana
|
|
 |