PDA

View Full Version : this is the error.


yatie
06-04-2003, 10:34 PM
This is the error:

Error Type:
ADODB.Recordset (0x800A0E79)
Operation is not allowed when the object is open.
/SaveInventory(test).asp, line 145



<%
dim oconn
dim oRS
dim strSource

set oConn=server.createobject("ADODB.connection")
set ors=server.createobject("ADODB.recordset")
strsource = "driver={microsoft access driver (*.mdb)}"
strsource = strsource &"; DBQ=c:/DataAmbridge.mdb"
oconn.connectionstring = strsource
oconn.open

sqltext = "Select * FROM INVENTORY"
oRS.Open sqltext, oConn
*
*
*
*
*
RetrieveRecord
if itemNo <> "" then
SaveItem(itemNo)
end if
*
*
*
function RetrieveRecord
itemNo = trim(Request.form("no"))
*
*
*
sub SaveItem(itemNo)
oRS.Source = "select * from INVENTORY "

oRS.Open

if oRS.EOF and oRS.BOF then
oRS.addnew
end if
oRS("TYPE")= "IPC"
*
*
*
oRS.Update
oRS.Close
set oRS=nothing
oconn.close
setoconn=nothing

%>

skriptkiddie
06-04-2003, 11:41 PM
Try passing your recordset object to your subroutine:

sub SaveItem(itemNo, oRS)

yatie
06-04-2003, 11:55 PM
Skriptkiddie....

I already try put oRS in sub saveitem. But i get this error:

Error Type:
Microsoft VBScript compilation (0x800A0414)
Cannot use parentheses when calling a Sub
/SaveInventory(test).asp, line 50, column 20
SaveItem(itemNo,oRS)

Lety
06-05-2003, 12:51 AM
Try also passing in oConn to your sub. It's hard to tell though as some of your code is missing.

jsawkang
06-05-2003, 02:17 AM
anyway, what ur code trying to do?

does it check for the itemno first then add to inventory table if it's not found it's?

yatie
06-05-2003, 03:00 AM
i already refer url that you give but still cannot.

Now, i show you my coding. My system not show any error but the record not save in the database.

This is the code:

<%
dim oconn
dim oRS
dim strSource

set oConn=server.createobject("ADODB.connection")
set ors=server.createobject("ADODB.recordset")
strsource = "driver={microsoft access driver (*.mdb)}"
strsource = strsource &"; DBQ=c:/DataAmbridge.mdb"
oconn.connectionstring = strsource
oconn.open

oRS.Source ="Select * from INVENTORY"
oRS.Open oConn


function RetrieveRecord

model = trim(request.form("model"))
status = trim(request.form("status"))
bringforward = trim(request.form("bringforward"))

if oRS.EOF and oRS.BOF then
oRS.addnew
end if

oRS("MODEL") = trim(model
oRS("status") = trim(status)
oRS("BRINGFORWARD") = trim("bringforward")

oRS.Update
oRS.Close
set oRS=nothing
oconn.close
set oconn=nothing
%>

jsawkang
06-05-2003, 03:57 AM
try this.

<%
dim oconn
dim oRS
dim strSource

set oConn=server.createobject("ADODB.connection")
set ors=server.createobject("ADODB.recordset")
strsource = "driver={microsoft access driver (*.mdb)}"
strsource = strsource &"; DBQ=c:/DataAmbridge.mdb"
oconn.connectionstring = strsource
oconn.open

oRS.Source ="Select * from INVENTORY"
oRS.Open oConn


function RetrieveRecord

model = trim(request.form("model"))
status = trim(request.form("status"))
bringforward = trim(request.form("bringforward"))

set oRS=server.CreateObject("ADODB.Recordset")
set oRS.ActiveConnection=cconn


If not oRS.EOF Then
Response.Write "Duplicated Record!"

else
with rs
.AddNew
.Fields("MODEL") = model
.Fields("status") = status
.Fields("BRINGFORWARD") = bringforward
.Update
end with
Response.Write "New Record Added Successfully"
end if
oRS.Close
set oRS=nothing
oconn.close
set oconn=nothing
%>

yatie
06-05-2003, 04:21 AM
I try like coding jsawkang suggest . But out this error. How?

Error Type:
ADODB.Recordset (0x800A0BB9)
Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.
/SaveInventory(test).asp, line 32

jsawkang
06-05-2003, 08:00 PM
Hi yatie,

check ur database field size.
the error msg "out or acceptable range" mean that ur database field size can't hold the amount of character u've entered. try change the field size or key-in less char.

i was wondering if u r trying to add record to database? if so, use the code below.

<%
sConnString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &server.MapPath("DataAmbridge.mdb")&";"

set oConn=server.CreateObject("ADODB.Connection")
oconn.open "Driver=Microsoft Access Driver (*.mdb); DBQ=" &server.MapPath("DataAmbridge.mdb")&";"


model = trim(request.form("model"))
status = trim(request.form("status"))
bringforward = trim(request.form("bringforward"))

set oRS=server.CreateObject("ADODB.Recordset")
set oRS.ActiveConnection=oconn

oRS.Source ="Select * from INVENTORY"
oRS.Open oConn

If not oRS.EOF Then
Response.Write "Duplicated Record!"

else
with oRS
.AddNew
.Fields("MODEL") = model
.Fields("status") = status
.Fields("BRINGFORWARD") = bringforward
.Update
end with
Response.Write "New Record Added Successfully"
end if
oRS.Close
set oRS=nothing
oconn.close
set oconn=nothing
%>

regards

yatie
06-05-2003, 08:40 PM
Hi... I already check the length & datatype in my ms access.. and try key in less char but still happend same error.

And i also try ur coding, but error still out like :

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Microsoft Access Driver]General error Unable to open registry key 'Temporary (volatile) Jet DSN for process 0xca4 Thread 0x8a0 DBC 0x1650a24 Jet'.
/SaveInventory1.asp, line 23


why?...

jsawkang
06-05-2003, 10:32 PM
replace this
sConnString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &server.MapPath("DataAmbridge.mdb")&";"

set oConn=server.CreateObject("ADODB.Connection")
oconn.open "Driver=Microsoft Access Driver (*.mdb); DBQ=" &server.MapPath("DataAmbridge.mdb")&";"




with this
set oConn=server.createobject("ADODB.connection")
set ors=server.createobject("ADODB.recordset")
strsource = "driver={microsoft access driver (*.mdb)}"
strsource = strsource &"; DBQ=c:/DataAmbridge.mdb"
oconn.connectionstring = strsource
oconn.open