PDA

View Full Version : my post file


yatie
06-13-2003, 09:49 PM
this is i attach my post file.

Angelika
06-13-2003, 10:24 PM
This is your page:

<!--#include File="adovbs.inc"-->
<!--#include file ="validDate.asp"-->
<!--#include file ="InvFunctions.asp"-->
<%
dim aa,bb,bil,nilaiTab,date_m,model,status,remark,bringforward
dim bms,flrbtm,suga,cct,calcomp,trutech,flaris
dim shortage,excess,transin,transout,delivery,cartondamage,missfromscon,rejectset
dim ok,b4rwk,stckambwh
dim bmm2,bmm1,qc
dim bf, resale,received,balance
dim bookbalance,grandstck,varian


'****Get Info from FORM*************************
itemNo= trim(Request.Form("no"))
if Request.Form("date_m") = "" then
dateB= "January 19,1900"
dateA= CDate(dateB)
else
dateA= Request.Form("date_m")
end if

todaydate= VDate(dateA)
checkedby= trim(Request.Form("checkedby"))
preparedby= trim(Request.Form("preparedby"))
Model= trim(Request.Form("model"))
status= trim(Request.Form("status"))
bringforward= trim(Request.Form("bringforward"))
bms= trim(Request.Form("bms"))
flrbtm= trim(Request.Form("flrbtm"))
suga= trim(Request.Form("suga"))
cct= trim(Request.Form("cct"))
calcomp= trim(Request.Form("calcomp"))
trutech= trim(Request.Form("trutech"))
flaris= trim(Request.Form("flaris"))
suga= trim(Request.Form("suga"))
shortage= trim(Request.Form("shortage"))
excess = trim(Request.Form("excess"))
transin = trim(Request.Form("transin"))
transout= trim(Request.Form("transout"))
delivery= trim(Request.Form("delivery"))
cartondamage= trim(Request.Form("cartondamage"))
missfromscon= trim(Request.Form("missfromscon"))
rejectset = trim(Request.Form("rejectset"))
ok= trim(Request.Form("ok"))
b4rwk= trim(Request.Form("b4rwk"))
stckambwh= trim(Request.Form("stckambwh"))
bmm2= trim(Request.Form("bmm2"))
bmm1= trim(Request.Form("bmm1"))
qc= trim(Request.Form("qc"))
bf= trim(Request.Form("bf"))
resale= trim(Request.Form("resale"))
received = trim(Request.Form("received"))
balance= trim(Request.Form("balance"))
bookbalance= trim(Request.Form("bookbalance"))
grandstck = trim(Request.Form("grandstck"))
varian= trim(Request.Form("varian"))
remark= trim(Request.Form("remark"))
funct= trim(Request.querystring("function")) 'C

'***Create and open Connection
myDSN= Server.CreateObject("ADODB.Connection")
myDSN.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=c:/DataAmbridge.mdb"
'Create recordset*********************
set getData=server.createobject("adodb.recordset")


getData.open "Select * from INVENTORY where CHECKED_BY='"&trim(session("checkedby"))&"' and PREPARED_BY = '"&trim(session("preparedby"))&"' and NO='"&trim(itemNo)&"'",myDSN,3,3

if getData.EOF and getData.BOF then
getData.AddNew
getData.Fields("TYPE")= "IPC"
getData.Fields("USERID")= "sazali"
getData.Fields("NO")= itemNo
getData.Fields("DATE")= todaydate
getData.Fields("CHECKED_BY")= checkedby
getData.Fields("PREPARED_BY")=Preparedby
getData.Fields("MODEL")= Model
getData.Fields("status")= status
getData.Fields("BF")= bringforward
getData.Fields("BMS")= bms
getData.Fields("IN_FLRBATAM")= flrbtm
getData.Fields("CCT")= cct
getData.Fields("IN_CALCOMP")= calcomp
getData.Fields("IN_TRUTECH")= trutech
getData.Fields("IN_FLARIS") = flaris
getData.Fields("IN_SUGA")= suga
getData.Fields("INV_SHORTAGE")= shortage
getData.Fields("INV_EXCESS")= excess
getData.Fields("TRANSIN")= transin
getData.Fields("TRANSOUT")= transout
getData.Fields("DELIVERY_EXP") = delivery
getData.Fields("CTN_DAMAGE")= cartondamage
getData.Fields("MISS_SCON") = missfromscon
getData.Fields("REJCT_SET")= rejectset
getData.Fields("STCK_PLO609")= ok
getData.Fields("B4_RWORK")= b4rwk
getData.Fields("STCK_AMBWH")= stckambwh
getData.Fields("RWORK_BMM2")= bmm2
getData.Fields("BMM1_BMM2")= bmm1
getData.Fields("RWORK_QC")= qc
getData.Fields("SCON_BF")= bf
getData.Fields("SCON_RSALE")= resale
getData.Fields("SCON_RECV") = received
getData.Fields("SCON_BAL")= balance
getData.Fields("BOOK_BAL")= bookbalance
getData.Fields("GRND_STCK") = grandstck
getData.Fields("VARIAN")= varian
getData.Fields("REMARKS")= remark
getData.Update
end if
getData.Close
set getData = nothing

select case funct
case "c"
Response.Redirect "Inventory_C.asp?a=1&b=1&tabValue=0"
case "e"
Response.Redirect "Inventory_E.asp?a=1&b=1&tabValue=0"
end select

%>

yatie
06-13-2003, 10:34 PM
Sorry...actually this page is post page for my email the other one with title Display record. I can save record, but if i call the record, all record can't displayed. The form page is i attach for u:

Angelika
06-13-2003, 11:02 PM
'***Create and open Connection
myDSN= Server.CreateObject("ADODB.Connection")
myDSN.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=c:/DataAmbridge.mdb"
'Create recordset*********************
set getData=server.createobject("adodb.recordset")

strSQL="Select * from INVENTORY "
strSQL=strSQL + "where PREPARED_BY='"&trim(session("preparedby"))&"' "
strSQL=strSQL + "and CHECKED_BY ='"&trim(session("checkedby"))&"' and NO='"&trim("no")&"'"
getData.Open strSQL,myDSN

If not getData.EOF =True Then

model= trim(getData("MODEL"))

........



End If
getData.close

yatie
06-13-2003, 11:26 PM
Angelika...

i already try ur code:

myDSN= Server.CreateObject("ADODB.Connection")
myDSN.open "driver={Microsoft Access Driver (*.mdb)};DBQ=c:/DataAmbridge.mdb"
set getData=server.createobject("adodb.recordset")

strSQL="Select * from INVENTORY"
strSQL= strSQL + "where PREPARED_BY = '"&trim(session("preparedby"))&"'"
strSQL = strSQL + "and CHECKED_BY = '"&trim(session("checkedby"))&"' and NO='"&trim("no")&"'"
getData.Open strSQL,myDSN

Why error :
Error Type:
Microsoft VBScript runtime (0x800A01A8)
Object required: 'myDSN'
/Inventory_C.asp, line 232

Line 232-->
myDSN.open "driver={Microsoft Access Driver (*.mdb)};DBQ=c:/DataAmbridge.mdb"

Whitesword
06-15-2003, 08:56 AM
Seems to me like you are missing the SET keyword...

SET myDSN= Server.CreateObject("ADODB.Connection")
^^^
myDSN.open "driver={Microsoft Access Driver (*.mdb)};DBQ=c:/DataAmbridge.mdb"
set getData=server.createobject("adodb.recordset")

That creates the object space for the myDSN variable... shoudl work now :)

yatie
06-15-2003, 07:58 PM
I try add set before myDSN...

set myDSN= Server.CreateObject("ADODB.Connection")
^^
myDSN.open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=c:/DataAmbridge.mdb"
'Create recordset********************************
set getData=server.createobject("ADODB.recordset")

strSQL = "Select * from INVENTORY"
strSQL = strSQL + "where PREPARED_BY = '"&trim(session("preparedby"))&"'"
strSQL = strSQL + "and CHECKED_BY = '"&trim(session("checkedby"))&"' and NO='"&trim("no")&"'"
getData.Open strSQL , myDSN

but error like this:

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC Microsoft Access Driver] Syntax error in FROM clause.
/Inventory_c.asp, line 240

Whitesword
06-16-2003, 07:25 AM
You need to add a space to the end of each line when using concatenation

Your SQL string will read like
"Select * from INVENTORYwhere PREPARE_BY=example_userand NO='no'"

Try:
strSQL = "Select * from INVENTORY "
strSQL = strSQL + "where PREPARED_BY = '"&trim(session("preparedby"))&"' "
strSQL = strSQL + "and CHECKED_BY = '"&trim(session("checkedby"))&"' and NO='"&trim("no")&"'"


Cheers :D

yatie
06-16-2003, 09:26 PM
TQ Whitesword...

I solve already that problem. But I got error regarding my save file...suddenly cannot save. Here i give u my code and error :

the code OK before . But....:(..i don't know now:

<!--#include File="adovbs.inc"-->
<!--#include file ="validDate.asp"-->
<!--#include file ="InvFunctions.asp"-->
<%

funct = trim(Request.querystring("function")) 'C

'dim aItem(7,3)

dim aa,bb,bil,nilaiTab,date_m,model,status,remark,bringforward
dim bms,flrbtm,suga,cct,calcomp,trutech,flaris
dim shortage,excess,transin,transout,delivery,cartondamage,missfromscon,rejectset
dim ok,b4rwk,stckambwh
dim bmm2,bmm1,qc
dim bf, resale,received,balance
dim bookbalance,grandstck,varian

myDSN="driver={Microsoft Access Driver (*.mdb)};DBQ=c:/DataAmbridge.mdb"
set getData=server.createobject("adodb.recordset")
getData.open "Select * from INVENTORY where CHECKED_BY='"&trim(session("checkedby"))&"' and PREPARED_BY = '"&trim(session("preparedby"))&"' and NO='"&trim(itemNo)&"'",myDSN,2,2

'for b = 1 to 7
' aItem(b,1) = request.form("ChkBox"&b&"")
' aItem(b,2) = request.form("no"&b&"")
' aItem(b,3) = request.form("S"&b&"")
' if trim(aItem(b,1)) = "ON" and not(trim(aItem(b,2))="") and not(trim(aItem(b,3))="")then
' Delete aItem(b,2)
' end if
' next

'RetrieveRecord
'if itemNo <> "" then
'SaveItem(itemNo)
'end if

'select case funct
' case "c"
' Response.Redirect "Inventory_C.asp?a=1&b=1&tabValue=0"
' case "e"
' Response.Redirect "Inventory_E.asp?a=1&b=1&tabValue=0"
'end select

'function RetrieveRecord

itemNo = trim(Request.Form("no"))
if Request.Form("date_m") = "" then
dateB = "January 19,1900"
dateA = CDate(dateB)
else
dateA = Request.Form("date_m")
end if
todaydate = VDate(dateA)
checkedby = trim(Request.Form("checkedby"))
preparedby = trim(Request.Form("preparedby"))
Model = trim(Request.Form("model"))
status = trim(Request.Form("status"))
bringforward = trim(Request.Form("bringforward"))
bms = trim(Request.Form("bms"))
flrbtm = trim(Request.Form("flrbtm"))
suga = trim(Request.Form("suga"))
cct = trim(Request.Form("cct"))
calcomp = trim(Request.Form("calcomp"))
trutech = trim(Request.Form("trutech"))
flaris = trim(Request.Form("flaris"))
suga = trim(Request.Form("suga"))
shortage = trim(Request.Form("shortage"))
excess = trim(Request.Form("excess"))
transin = trim(Request.Form("transin"))
transout = trim(Request.Form("transout"))
delivery = trim(Request.Form("delivery"))
cartondamage = trim(Request.Form("cartondamage"))
missfromscon = trim(Request.Form("missfromscon"))
rejectset = trim(Request.Form("rejectset"))
ok = trim(Request.Form("ok"))
b4rwk = trim(Request.Form("b4rwk"))
stckambwh = trim(Request.Form("stckambwh"))
bmm2 = trim(Request.Form("bmm2"))
bmm1 = trim(Request.Form("bmm1"))
qc = trim(Request.Form("qc"))
bf = trim(Request.Form("bf"))
resale = trim(Request.Form("resale"))
received = trim(Request.Form("received"))
balance = trim(Request.Form("balance"))
bookbalance = trim(Request.Form("bookbalance"))
grandstck = trim(Request.Form("grandstck"))
varian = trim(Request.Form("varian"))
remark = trim(Request.Form("remark"))



'sub SaveItem(itemNo)
'sub itemNo()

'getData.Source = "select * from INVENTORY "
'getData.Open

if getData.EOF and getData.BOF then
'Response.Write "Duplicated Record!"
getData.AddNew
end if

getData.Fields("TYPE") = "IPC"
getData.Fields("USERID") = "sazali"
getData.Fields("NO") = itemNo
getData.Fields("DATE") = todaydate

getData.Fields("CHECKED_BY") = Checkedby
getData.Fields("PREPARED_BY") = Preparedby

getData.Fields("MODEL") = Model
getData.Fields("status") = status
getData.Fields("BF") = bringforward
getData.Fields("BMS") = bms
getData.Fields("IN_FLRBATAM") = flrbtm
getData.Fields("CCT") = cct
getData.Fields("IN_CALCOMP") = calcomp
getData.Fields("IN_TRUTECH") = trutech
getData.Fields("IN_FLARIS") = flaris
getData.Fields("IN_SUGA") = suga
getData.Fields("INV_SHORTAGE") = shortage
getData.Fields("INV_EXCESS") = excess
getData.Fields("TRANSIN") = transin
getData.Fields("TRANSOUT") = transout
getData.Fields("DELIVERY_EXP") = delivery
getData.Fields("CTN_DAMAGE") = cartondamage
getData.Fields("MISS_SCON") = missfromscon
getData.Fields("REJCT_SET") = rejectset
getData.Fields("STCK_PLO609") = ok
getData.Fields("B4_RWORK") = b4rwk
getData.Fields("STCK_AMBWH") = stckambwh
getData.Fields("RWORK_BMM2") = bmm2
getData.Fields("BMM1_BMM2") = bmm1
getData.Fields("RWORK_QC") = qc

getData.Fields("SCON_BF") = bf
getData.Fields("SCON_RSALE") = resale
getData.Fields("SCON_RECV") = received
getData.Fields("SCON_BAL") = balance
getData.Fields("BOOK_BAL") = bookbalance
getData.Fields("GRND_STCK") = grandstck
getData.Fields("VARIAN") = varian
getData.Fields("REMARKS") = remark

getData.Update

select case funct
case "c"
Response.Redirect "Inventory_C.asp?a=1&b=1&tabValue=0"
case "e"
Response.Redirect "Inventory_E.asp?a=1&b=1&tabValue=0"
end select
getData.Close
set getData = nothing
'end sub
%>

The error existing is :

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Microsoft Access Driver] Cannot update. Database or object is read-only.
/cuba.asp, line 146



Please help me.

Whitesword
06-17-2003, 02:25 PM
Try this file I have uploaded... it's a rewrite of your code and should make for faster processing. If you get another 80004005 error, I recommend checking out the following:
http://www.aspfaq.com/show.asp?id=2009 .

There could be some formatting problems as well. I think everything was text or string based, except the date type field. If this field in the database is numeric, it should work fine. If it's a date/time field, add a '#' on either side of the number, i.e. change {" & todaydate & "} to {#" & todaydate & "#}.

Another possible error with this is one that says something like "Operation must use an updateable query", then check out http://www.aspfaq.com/show.asp?id=2062.

Hope this helps
Cheers

yatie
06-17-2003, 08:27 PM
Whitesword...i try ur code. May i Know..when getData declare...

because i get some error:

Error Type:
Microsoft VBScript runtime (0x800A01A8)
Object required: 'getData'
/temp.asp, line 98

Whitesword
06-17-2003, 11:25 PM
Oops... :D

I forgot about that...

Try this then.

Cheers

yatie
06-18-2003, 02:38 AM
whitesword...

TQ coz help & heard my problem.. I get one error...that is :

Error Type:
Microsoft JET Database Engine (0x80040E14)
Syntax error in INSERT INTO statement.
/temp1.asp, line 148

i Check all field name buat still same with in database. Tell me why?.

Whitesword
06-18-2003, 01:58 PM
Yes, I can... there were actually several that took a while to nut down... all typos.

There is a new version here that has all the typos taken out and has sort of worked.

If there are any further errors, then they are of the "invalid field format" type. You will have to compare the field types. With the exception of [todaydate] all field in the SQL statements are text based. If any of the fields in your Access database are numeric, you will have to find the appropriate field in the SQL statements and remove the quotes.

Date fields need to have a hash sign before and after the actual date value... e.g. ",#" & datefieldspecified & "#,"

Cheers

yatie
06-18-2003, 10:44 PM
TQ all whitesword... ;)