(Msg. 1) Posted: Wed May 27, 2009 7:05 am
Post subject: ado connection problem Archived from groups: microsoft>public>frontpage>client (more info?)
Hi
I have created a connection to a database but I get the following error
What can be the cause of such an error
.........................................................................
ADODB.Recordset error '800a0e7d'
The connection cannot be used to perform this operation. It is either closed
or invalid in this context.
If Len(ipMemberID)>0 AND IsNumeric(ipMemberID) Then
sUpdate="SELECT * FROM tblMembers WHERE ID=" & ipMemberID
Set opConnection=Server.CreateObject("ADODB.Connection")
Set opRecordset=Server.CreateObject("ADODB.Recordset")
opRecordset.open sUpdate, opConnection
If NOT opRecordset.Eof Then
sUpdate = "UPDATE ( sql here)
opConnection.execute(sUpdate)
'Close the recordset object
opRecordset.Close
Set opRecordset=Nothing
%>
(Msg. 2) Posted: Thu May 28, 2009 5:25 am
Post subject: Re: ado connection problem [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
No need to open the record set or check if it is found
- If the ipMemberID is not found, no update will occur
Plus you need to first open your DB connection, and set the Command Type to &H0001
If value1 is a text value, and field1 is the field you are updating then:
IF Len(ipMemberID)>0 AND IsNumeric(ipMemberID) THEN
sUpdate = "UPDATE tblMembers Set field1='" & value1 & " WHERE ID=" & ipMemberID
Const ADOadCmdText = &H0001
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open ConnStr 'where ConnStr is your DB connection string to open the DB
Set objCmd = Server.CreateObject("ADODB.Command")
Set objCmd.ActiveConnection = objConn
objCmd.CommandText = sUpdate
objCmd.CommandType = ADOadCmdText
objCmd.Execute
Set objCmd = Nothing
objConn.Close
Set objConn = Nothing
END IF
--
_____________________________________________
SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
"Warning - Using the F1 Key will not break anything!" (-;
_____________________________________________
"Paul M" <paul.DeleteThis@newsgroup.co.uk> wrote in message news:%23U5UMHr3JHA.5276@TK2MSFTNGP04.phx.gbl...
| Hi
| I have created a connection to a database but I get the following error
| What can be the cause of such an error
| ........................................................................
| ADODB.Recordset error '800a0e7d'
|
| The connection cannot be used to perform this operation. It is either closed
| or invalid in this context.
|
| .......................................................................................
|
| Here is the code
|
|
| If Len(ipMemberID)>0 AND IsNumeric(ipMemberID) Then
| sUpdate="SELECT * FROM tblMembers WHERE ID=" & ipMemberID
| Set opConnection=Server.CreateObject("ADODB.Connection")
| Set opRecordset=Server.CreateObject("ADODB.Recordset")
| opRecordset.open sUpdate, opConnection
| If NOT opRecordset.Eof Then
|
|
|
| sUpdate = "UPDATE ( sql here)
|
|
| opConnection.execute(sUpdate)
|
| 'Close the recordset object
| opRecordset.Close
| Set opRecordset=Nothing
| %>
|
|
(Msg. 3) Posted: Mon Jun 08, 2009 1:05 pm
Post subject: Re: ado connection problem [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
Thanks Stefan
Best wishes
Paul M
"Stefan B Rusynko" <sbr_enjoy.RemoveThis@hotmail.com> wrote in message
news:eri1JZ33JHA.1196@TK2MSFTNGP03.phx.gbl...
> No need to open the record set or check if it is found
> - If the ipMemberID is not found, no update will occur
>
> Plus you need to first open your DB connection, and set the Command Type
> to &H0001
>
> If value1 is a text value, and field1 is the field you are updating then:
>
> IF Len(ipMemberID)>0 AND IsNumeric(ipMemberID) THEN
> sUpdate = "UPDATE tblMembers Set field1='" & value1 & " WHERE ID=" &
> ipMemberID
> Const ADOadCmdText = &H0001
> Set objConn = Server.CreateObject("ADODB.Connection")
> objConn.Open ConnStr 'where ConnStr is your DB connection string
> to open the DB
> Set objCmd = Server.CreateObject("ADODB.Command")
> Set objCmd.ActiveConnection = objConn
> objCmd.CommandText = sUpdate
> objCmd.CommandType = ADOadCmdText
> objCmd.Execute
> Set objCmd = Nothing
> objConn.Close
> Set objConn = Nothing
> END IF
>
>
> --
>
> _____________________________________________
> SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
> "Warning - Using the F1 Key will not break anything!" (-;
> _____________________________________________
>
>
> "Paul M" <paul.RemoveThis@newsgroup.co.uk> wrote in message
> news:%23U5UMHr3JHA.5276@TK2MSFTNGP04.phx.gbl...
> | Hi
> | I have created a connection to a database but I get the following error
> | What can be the cause of such an error
> | ........................................................................
> | ADODB.Recordset error '800a0e7d'
> |
> | The connection cannot be used to perform this operation. It is either
> closed
> | or invalid in this context.
> |
> |
> .......................................................................................
> |
> | Here is the code
> |
> |
> | If Len(ipMemberID)>0 AND IsNumeric(ipMemberID) Then
> | sUpdate="SELECT * FROM tblMembers WHERE ID=" & ipMemberID
> | Set opConnection=Server.CreateObject("ADODB.Connection")
> | Set opRecordset=Server.CreateObject("ADODB.Recordset")
> | opRecordset.open sUpdate, opConnection
> | If NOT opRecordset.Eof Then
> |
> |
> |
> | sUpdate = "UPDATE ( sql here)
> |
> |
> | opConnection.execute(sUpdate)
> |
> | 'Close the recordset object
> | opRecordset.Close
> | Set opRecordset=Nothing
> | %>
> |
> |
>
>
All times are: Eastern Time (US & Canada) (change)
Page 1 of 1
You can post new topics in this forum You can reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum