diggable Report post Posted January 14, 2011 having problem with EOF error. 1 table with 8 fields I just want a plain chart with date as the series and the rest are columns (bakery, meat etc.) I tried to follow some of the samples provided but it doesn't have a simple query sample. thanks in advance! <%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%> <!--#include file="../Connections/DepartmentSales.asp" --> <% Dim rsDepSales Dim rsDepSales_cmd Dim rsDepSales_numRows Dim StrQuery Dim Intcounter intcounter = 0 Set rsDepSales_cmd = Server.CreateObject ("ADODB.Command") rsDepSales_cmd.ActiveConnection = MM_DepartmentSales_STRING 'Generate the chart element string strXML = "<chart palette='2' caption='Factory' zAxisname='Date' showvalues='1' labelstpe='2'>" 'Now we get the data for the factory rsDepSales_cmd.CommandText = "SELECT * FROM dbo.Department WHERE [Date] = '12/29/2010'" rsDepSales_cmd.Prepared = true Set rsDepSales = rsDepSales_cmd.Execute rsDepSales_numRows = 0 Whole Not rsDepSales.Eof 'Here, we convert date into a more readable format for set label. strXML = strXML & "<set label ='Bakery'" & "Value='<%=(rsDepSales.Fields.Item("Date").Value)%>'/>" & "<set label ='Dairy'" & "Value='<%=(rsDepSales.Fields.Item("Date").Value)%>'/>" set rsDepsales = Nothing rsdepsales.movenext Wend 'Close <chart> element strXML = strXML & "</chart>" set rsdepsales = nothing Response.Write(strXML) %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Chart Test 01</title> </head> <body> <%=(rsDepSales.Fields.Item("Date").Value)%> </body> </html> <% rsDepSales.Close() Set rsDepSales = Nothing %> Share this post Link to post Share on other sites
JediJon Report post Posted March 2, 2011 (edited) Its probably an isue wth the date format try yyyy-mm-dd as the date format heres a function that will format the date as yyyy-mm-dd function sql_date(date_string) if isdate(date_string) then dd = Day(date_string) mm = month(date_string) yyyy = Year(date_string) sql_date = yyyy & "-" & mm & "-" & dd else dd = Day(date) mm = month(date) yyyy = Year(date) sql_date = yyyy & "-" & mm & "-" & dd end if end function Cheers Jon Edited March 2, 2011 by JediJon Share this post Link to post Share on other sites