ple help me anyone
i am using ms access database
tqty is text fields
rsCount.open "Select Sum(TQty) as temp from tbl_style where IPomsID="&
cdbl(request("IPomsID")),con,2,3
If tqty is text, you cannot apply the Sum aggregate function to a text
field. What are you expecting this query to return? From the name of the
variable, rsCount, perhaps you are trying to find out how many records exist
with the specified lPomsID? If so, you need to use the Count function
instead of the Sum function. If so, reply and let us know because you need
to be made aware of how Count works.
Nothing to do with your problem but, hopefully you've done some validation
before attempting to run this statement so you don't get an error if
request("IPomsID") does not contain a number. This validation should be done
in your server-side code, before you even open your connection object. Do
not depend on client-side validation. Always validate user inputs in your
server-side code.
Also, it is a very bad practice to not specify the collection from which you
wish to retrieve the "IPomsID" variable. Never use request("IPomsID").
Always be explicit:: either request.form("IPomsID") or
request.querystring("IPomsID").
Further points to consider:
Your use of dynamic sql is leaving you vulnerable to hackers using sql
injection:
http://mvp.unixwiz.net/techtips/sql-injection.html
http://www.sqlsecurity.com/DesktopDefault.aspx?tabid=23
See here for a better, more secure way to execute your queries by using
parameter markers:
http://groups-beta.google.com/group/microsoft.public.inetserver.asp.db/msg/72e36562fee7804e
Personally, I prefer using stored procedures, or saved parameter queries
as
they are known in Access:
Access:
http://www.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&[email protected]
http://groups.google.com/groups?hl=...=1&[email protected]