SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseSQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old July 23rd, 2001, 03:21 PM
Steve Schofield Steve Schofield is offline
Contributing User
ASP Free God 20th Plane (14500 - 14999 posts)
 
Join Date: Dec 2002
Posts: 14,575 Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 22
Using Database Transactions from simple ASP

Originally posted by : Allan (aspielma@yahoo.com)Using Database Transactions from simple ASP (NOT MAllan - 7/23/2001 2:12:10 PM-------------------------------------------------------------------------------- I am trying to use database transactions from ASP. It is not an MTS environment, nor am I using VB components. I hope this is possible. I saw some very helpful info at: http://www.4guysfromrolla.com/webtech/081800-1.shtml I make a connection , then run a few updates using command objects, and no recordsets. Howeverm when I try to use objConn.BeginTrans, I get the following error at the SECOND command object: Microsoft OLE DB Provider for ODBC Drivers error '80004005' Transaction cannot have multiple recordsets with this cursor type. Change the cursor type, commit the transaction, or close one of the recordsets. I am not using any record set objects here! Here is my code: 'Make database connection. Set dbWebReg = OpenNewConnection(Application("WebRegConnectString")) dbWebReg.BeginTrans ' first database action Set vDBCommand = Server.CreateObject("ADODB.Command") Set vDBCommand.ActiveConnection = dbWebReg vDBCommand.CommandText = "prcUpdateStaId" vDBCommand.CommandType = adCmdStoredProc vDBCommand.Parameters.Append vDBCommand.CreateParameter("@RegCde", adInteger, adParamInput, , Session("RegCode")) vDBCommand.Parameters.Append vDBCommand.CreateParameter("@StaId", adInteger, adParamInput, , -2) vDBCommand.Execute Set vDBCommand = Nothing ' second database action Set vDBCommand = Server.CreateObject("ADODB.Command") Set vDBCommand.ActiveConnection = dbWebReg vDBCommand.CommandText = "prcInsertVersion" vDBCommand.CommandType = adCmdStoredProc '*** Load up the parameters. vDBCommand.Parameters.Append vDBCommand.CreateParameter("@RegCde", adInteger, adParamInput, , Session("RegCode")) vDBCommand.Parameters.Append vDBCommand.CreateParameter("@OrgWrkTitle", adChar, adParamInput, 60, Ucase(Request.QueryString("txtTitle"))) vDBCommand.Parameters.Append vDBCommand.CreateParameter("@OrgIswCde", adChar, adParamInput, 11, Ucase(Request.QueryString("txtISWC"))) vDBCommand.Parameters.Append vDBCommand.CreateParameter("@IsoLngCde", adChar, adParamInput, 2, Request.QueryString("cboISOLanguage")) vDBCommand.Parameters.Append vDBCommand.CreateParameter("@Wtr1FstNa", adChar, adParamInput, 30, Ucase(Request.QueryString("txtFirstName"))) vDBCommand.Parameters.Append vDBCommand.CreateParameter("@Wtr1LstNa", adChar, adParamInput, 45, Ucase(Request.QueryString("txtLastName"))) vDBCommand.Parameters.Append vDBCommand.CreateParameter("@SrcDes", adChar, adParamInput, 60, Request.QueryString("txtSource")) vDBCommand.Parameters.Append vDBCommand.CreateParameter("@CreUid", adChar, adParamInput, 15, Session("UserName")) vDBCommand.Parameters.Append vDBCommand.CreateParameter("@UpdUid", adChar, adParamInput, 15, Session("UserName")) vDBCommand.Execute Set vDBCommand = Nothing

Reply With Quote
  #2  
Old July 24th, 2001, 10:14 AM
Steve Schofield Steve Schofield is offline
Contributing User
ASP Free God 20th Plane (14500 - 14999 posts)
 
Join Date: Dec 2002
Posts: 14,575 Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 22
Originally posted by : Tim Curtin (Tcurtin@nhhartford.com)use 2 different command objects------------Allan at 7/23/2001 1:21:12 PMUsing Database Transactions from simple ASP (NOT MAllan - 7/23/2001 2:12:10 PM-------------------------------------------------------------------------------- I am trying to use database transactions from ASP. It is not an MTS environment, nor am I using VB components. I hope this is possible. I saw some very helpful info at: http://www.4guysfromrolla.com/webtech/081800-1.shtml I make a connection , then run a few updates using command objects, and no recordsets. Howeverm when I try to use objConn.BeginTrans, I get the following error at the SECOND command object: Microsoft OLE DB Provider for ODBC Drivers error '80004005' Transaction cannot have multiple recordsets with this cursor type. Change the cursor type, commit the transaction, or close one of the recordsets. I am not using any record set objects here! Here is my code: 'Make database connection. Set dbWebReg = OpenNewConnection(Application("WebRegConnectString")) dbWebReg.BeginTrans ' first database action Set vDBCommand = Server.CreateObject("ADODB.Command") Set vDBCommand.ActiveConnection = dbWebReg vDBCommand.CommandText = "prcUpdateStaId" vDBCommand.CommandType = adCmdStoredProc vDBCommand.Parameters.Append vDBCommand.CreateParameter("@RegCde", adInteger, adParamInput, , Session("RegCode")) vDBCommand.Parameters.Append vDBCommand.CreateParameter("@StaId", adInteger, adParamInput, , -2) vDBCommand.Execute Set vDBCommand = Nothing ' second database action Set vDBCommand = Server.CreateObject("ADODB.Command") Set vDBCommand.ActiveConnection = dbWebReg vDBCommand.CommandText = "prcInsertVersion" vDBCommand.CommandType = adCmdStoredProc '*** Load up the parameters. vDBCommand.Parameters.Append vDBCommand.CreateParameter("@RegCde", adInteger, adParamInput, , Session("RegCode")) vDBCommand.Parameters.Append vDBCommand.CreateParameter("@OrgWrkTitle", adChar, adParamInput, 60, Ucase(Request.QueryString("txtTitle"))) vDBCommand.Parameters.Append vDBCommand.CreateParameter("@OrgIswCde", adChar, adParamInput, 11, Ucase(Request.QueryString("txtISWC"))) vDBCommand.Parameters.Append vDBCommand.CreateParameter("@IsoLngCde", adChar, adParamInput, 2, Request.QueryString("cboISOLanguage")) vDBCommand.Parameters.Append vDBCommand.CreateParameter("@Wtr1FstNa", adChar, adParamInput, 30, Ucase(Request.QueryString("txtFirstName"))) vDBCommand.Parameters.Append vDBCommand.CreateParameter("@Wtr1LstNa", adChar, adParamInput, 45, Ucase(Request.QueryString("txtLastName"))) vDBCommand.Parameters.Append vDBCommand.CreateParameter("@SrcDes", adChar, adParamInput, 60, Request.QueryString("txtSource")) vDBCommand.Parameters.Append vDBCommand.CreateParameter("@CreUid", adChar, adParamInput, 15, Session("UserName")) vDBCommand.Parameters.Append vDBCommand.CreateParameter("@UpdUid", adChar, adParamInput, 15, Session("UserName")) vDBCommand.Execute Set vDBCommand = Nothing

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseSQL Development > Using Database Transactions from simple ASP


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway