Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

select sum() problem

Status
Not open for further replies.

parames

MIS
Jun 26, 2000
71
MY
hi gang.. i want to select sum of a particular field in my tale, so my code look like this..

Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "DSN=project;UID=root;pwd="

Query1 = "SELECT sum(invonhand) from store where status ='SQ' and productitem = '"& RS("productitem") &"'"

Set RS1= Conn.Execute(Query1)

the problem is i don't know how to output the result..
i tried this two method but cannot get the output.. it shows error message

1) response.write RS1
2) output = RS1("invonhand")

please help..

thanks a lot..

rgds,
parames.s
 
You should name the output field in the sql.

Query1 = "SELECT sum(invonhand) as sumofinv from store where status ='SQ' and productitem = '"& RS("productitem") &"'"

then

response.write sumofinv

Mark
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top