Jump to content
Sign in to follow this  
salman.pirani

Average code is not working

Recommended Posts

Please Help Error

SELECT AVG® AS Average FROM tform WHERE pt='Taming the Time Monster'

Microsoft OLE DB Provider for SQL Server error '80040e07'

The average aggregate operation cannot take a varchar data type as an argument.

/hr/tform/admin/avrage.asp, line 20

Code<%strConnect ="Provider=SQLOLEDB.1;Persist Security Info=False;User ID=usrtform;Initial Catalog=hrtform;Data Source=intranet;pwd=tform123"set cn= server.createobject("adodb.connection")set rs=server.createobject("adodb.recordset")cn.open strConnect sql="SELECT AVG® AS Average FROM tform WHERE pt='" & Request.Form("id") & "'"response.Write(sql)set rs=cn.execute(sql) %> <% do until rs.EOF%><tr> <%for each x in rs.Fields%> <td><%Response.Write(x.value)%></td> <%next rs.MoveNext%></tr> <%looprs.closecn.close%>

Share this post


Link to post
Share on other sites

The error message is pretty self-explanatory: The average aggregate operation cannot take a varchar data type as an argument.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×