p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

asp_databases thread: EOF in Access


Message #1 by "Elizabeta Siljanovski" <elizabetas@m...> on Wed, 19 Dec 2001 19:11:50 -0500
This is a multi-part message in MIME format.



------=_NextPart_000_0001_01C188C1.07D9E270

Content-Type: text/plain;

	charset="us-ascii"

Content-Transfer-Encoding: 7bit



I have a problem updating database. The form string from the previous

page is read fine, the value is prinet as it shluld be ,

One is a string and the other one is booleean and that one prints as

False/True.

 

This is the code:

 

<%

 

dim rsUpdate

set rsUpdate = Server.CreateObject("ADODB.Recordset")

rsUpdate.Open "Part", strConnect, adOpenForwardOnly, adLockOptimistic

 

rsUpdate.Filter = "Part = '" & Request.Form ("Part") & "'"

 

rsUpdate("Status") = Request.Form ("Status")

 

rsUpdate.Update

 

 

%>

 

I've tried putting the values in variables first but that didn't work

either.

 

thanks








Message #2 by "Ken Schaefer" <ken@a...> on Thu, 20 Dec 2001 13:27:12 +1100
You say you have a problem. WHAT is the problem? Is it too much to ask that

you post the error message you are receiving?



PS Have you thought of just using an SQL statement to do this?



<%

strSQL = _

    "UPDATE [Part] " & _

    "SET [Status] = '" & Request.Form("Status") & "' " & _

    "WHERE [Part] = '" & Request.Form("Part") & "'"



objConn.Execute strSQL, lngRecsAffected, adCmdText+adExecuteNoRecords



If lngRecsAffected = 0 then

    Response.Write("No records updated")

Else

    Response.Write(lngRecsAffected & " record(s) updated")

End If

%>



This avoids opening the whole table, searching to find the records you need,

and then updating only the first record. Secondly, your current code has a

problem in that it doesn't check to see if there is a match for your

criteria before attempting an update.



Cheers

Ken



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

From: "Elizabeta Siljanovski" <elizabetas@m...>

Subject: [asp_databases] EOF in Access





: I have a problem updating database. The form string from the previous

: page is read fine, the value is prinet as it shluld be ,

: One is a string and the other one is booleean and that one prints as

: False/True.

:

: This is the code:

:

: <%

:

: dim rsUpdate

: set rsUpdate = Server.CreateObject("ADODB.Recordset")

: rsUpdate.Open "Part", strConnect, adOpenForwardOnly, adLockOptimistic

:

: rsUpdate.Filter = "Part = '" & Request.Form ("Part") & "'"

:

: rsUpdate("Status") = Request.Form ("Status")

:

: rsUpdate.Update

:

:

: %>

:

: I've tried putting the values in variables first but that didn't work

: either.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



Message #3 by "Kim Iwan Hansen" <kimiwan@k...> on Thu, 20 Dec 2001 03:00:26 +0100
This is a multi-part message in MIME format.



------=_NextPart_000_0002_01C18902.79BB6A30

Content-Type: text/plain;

	charset="us-ascii"

Content-Transfer-Encoding: 7bit



you need to use adOpenStatic instead of adOpenForwardOnly to be able to

update the recordset.



-Kim



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

  From: Elizabeta Siljanovski [mailto:elizabetas@m...]

  Sent: 20. december 2001 01:12

  To: ASP Databases

  Subject: [asp_databases] EOF in Access





  I have a problem updating database. The form string from the previous page

is read fine, the value is prinet as it shluld be ,



  One is a string and the other one is booleean and that one prints as

False/True.







  This is the code:







  <%







  dim rsUpdate



  set rsUpdate = Server.CreateObject("ADODB.Recordset")



  rsUpdate.Open "Part", strConnect, adOpenForwardOnly, adLockOptimistic







  rsUpdate.Filter = "Part = '" & Request.Form ("Part") & "'"







  rsUpdate("Status") = Request.Form ("Status")







  rsUpdate.Update











  %>







  I've tried putting the values in variables first but that didn't work

either.







  thanks






$subst('Email.Unsub').






Message #4 by "Elizabeta Siljanovski" <elizabetas@m...> on Wed, 19 Dec 2001 23:19:50 -0500
This is a multi-part message in MIME format.



------=_NextPart_000_0008_01C188E3.AC046F10

Content-Type: text/plain;

	charset="us-ascii"

Content-Transfer-Encoding: 7bit



There are two types of messages I'm getting. If I use adopenDynamic I

get :

 

 Error Type:

ADODB.Recordset (0x800A0CB3)

Current Recordset does not support updating. This may be a limitation of

the provider, or of the selected locktype.

/TechStatus/SetUpdate.asp, line 29

 

If I use adOpenForward only: I get "file (database) read only.

 

Database is just an access file on my computer and it's not read only.

Are there any other permissions I have to set or is this just a code

problem?

 

Thanks.

 

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

From: Kim Iwan Hansen [mailto:kimiwan@k...] 

Sent: Wednesday, December 19, 2001 9:00 PM

To: ASP Databases

Subject: [asp_databases] RE: EOF in Access

 

you need to use adOpenStatic instead of adOpenForwardOnly to be able to

update the recordset.

 

-Kim

 

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

From: Elizabeta Siljanovski [mailto:elizabetas@m...]

Sent: 20. december 2001 01:12

To: ASP Databases

Subject: [asp_databases] EOF in Access

I have a problem updating database. The form string from the previous

page is read fine, the value is prinet as it shluld be ,

One is a string and the other one is booleean and that one prints as

False/True.

 

This is the code:

 

<%

 

dim rsUpdate

set rsUpdate = Server.CreateObject("ADODB.Recordset")

rsUpdate.Open "Part", strConnect, adOpenForwardOnly, adLockOptimistic

 

rsUpdate.Filter = "Part = '" & Request.Form ("Part") & "'"

 

rsUpdate("Status") = Request.Form ("Status")

 

rsUpdate.Update

 

 

%>

 

I've tried putting the values in variables first but that didn't work

either.

 

thanks




$subst('Email.Unsub'). 




$subst('Email.Unsub'). 








Message #5 by "Elizabeta Siljanovski" <elizabetas@m...> on Wed, 19 Dec 2001 23:23:36 -0500
Maybe I'm wrong but when you capitalize letters in your message I feel

like you are yelling at me.



Error was EOF as I suggested in my message subject and the reason I

don't have controls for the criteria missmatch because I get those

errors from server if I have that type of problems. 



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

From: Ken Schaefer [mailto:ken@a...] 

Sent: Wednesday, December 19, 2001 9:27 PM

To: ASP Databases

Subject: [asp_databases] Re: EOF in Access



You say you have a problem. WHAT is the problem? Is it too much to ask

that

you post the error message you are receiving?



PS Have you thought of just using an SQL statement to do this?



<%

strSQL = _

    "UPDATE [Part] " & _

    "SET [Status] = '" & Request.Form("Status") & "' " & _

    "WHERE [Part] = '" & Request.Form("Part") & "'"



objConn.Execute strSQL, lngRecsAffected, adCmdText+adExecuteNoRecords



If lngRecsAffected = 0 then

    Response.Write("No records updated")

Else

    Response.Write(lngRecsAffected & " record(s) updated")

End If

%>



This avoids opening the whole table, searching to find the records you

need,

and then updating only the first record. Secondly, your current code has

a

problem in that it doesn't check to see if there is a match for your

criteria before attempting an update.



Cheers

Ken



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

From: "Elizabeta Siljanovski" <elizabetas@m...>

Subject: [asp_databases] EOF in Access





: I have a problem updating database. The form string from the previous

: page is read fine, the value is prinet as it shluld be ,

: One is a string and the other one is booleean and that one prints as

: False/True.

:

: This is the code:

:

: <%

:

: dim rsUpdate

: set rsUpdate = Server.CreateObject("ADODB.Recordset")

: rsUpdate.Open "Part", strConnect, adOpenForwardOnly, adLockOptimistic

:

: rsUpdate.Filter = "Part = '" & Request.Form ("Part") & "'"

:

: rsUpdate("Status") = Request.Form ("Status")

:

: rsUpdate.Update

:

:

: %>

:

: I've tried putting the values in variables first but that didn't work

: either.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~








$subst('Email.Unsub').





Message #6 by "Ken Schaefer" <ken@a...> on Thu, 20 Dec 2001 23:26:11 +1100
"Error was EOF" doesn't mean much. Can you please post the exact error

message (the entire error message) that you are receiving.



I believe (as I said before) that the error is being caused because you do

not check to see if there is a record that matches your criteria before you

try to delete it. If there is no matching record you can't delete it - if

there is no matching record, the recordset is .EOF (End of File) - you can't

delete a record when the cursor does not point to a record.



FWIW, Access does not support adOpenDynamic. If you are using OLEDB, you

will automagically receive an adOpenKeySet cursor

(www.adopenstatic.com/faq/jetcursortypes.asp) - if you are using ODBC you

will probably receive the error you are receiving (that adOpenDynamic is not

supported)



Cheers

Ken



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

From: "Elizabeta Siljanovski" <elizabetas@m...>

Subject: [asp_databases] Re: EOF in Access





: Maybe I'm wrong but when you capitalize letters in your message I feel

: like you are yelling at me.

:

: Error was EOF as I suggested in my message subject and the reason I

: don't have controls for the criteria missmatch because I get those

: errors from server if I have that type of problems.

:

: -----Original Message-----

: From: Ken Schaefer [mailto:ken@a...]

: Sent: Wednesday, December 19, 2001 9:27 PM

: To: ASP Databases

: Subject: [asp_databases] Re: EOF in Access

:

: You say you have a problem. WHAT is the problem? Is it too much to ask

: that

: you post the error message you are receiving?

:

: PS Have you thought of just using an SQL statement to do this?

:

: <%

: strSQL = _

:     "UPDATE [Part] " & _

:     "SET [Status] = '" & Request.Form("Status") & "' " & _

:     "WHERE [Part] = '" & Request.Form("Part") & "'"

:

: objConn.Execute strSQL, lngRecsAffected, adCmdText+adExecuteNoRecords

:

: If lngRecsAffected = 0 then

:     Response.Write("No records updated")

: Else

:     Response.Write(lngRecsAffected & " record(s) updated")

: End If

: %>

:

: This avoids opening the whole table, searching to find the records you

: need,

: and then updating only the first record. Secondly, your current code has

: a

: problem in that it doesn't check to see if there is a match for your

: criteria before attempting an update.

:

: Cheers

: Ken

:

: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

: From: "Elizabeta Siljanovski" <elizabetas@m...>

: Subject: [asp_databases] EOF in Access

:

:

: : I have a problem updating database. The form string from the previous

: : page is read fine, the value is prinet as it shluld be ,

: : One is a string and the other one is booleean and that one prints as

: : False/True.

: :

: : This is the code:

: :

: : <%

: :

: : dim rsUpdate

: : set rsUpdate = Server.CreateObject("ADODB.Recordset")

: : rsUpdate.Open "Part", strConnect, adOpenForwardOnly, adLockOptimistic

: :

: : rsUpdate.Filter = "Part = '" & Request.Form ("Part") & "'"

: :

: : rsUpdate("Status") = Request.Form ("Status")

: :

: : rsUpdate.Update

: :

: :

: : %>

: :

: : I've tried putting the values in variables first but that didn't work

: : either.

: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

:

:




: $subst('Email.Unsub').

:

:

:




$subst('Email.Unsub').




  Return to Index