User (Legacy) Posted December 27, 1999 Report Share Posted December 27, 1999 Hi, I am try to draw some graphs using the output I get from querying a MS-SQL (7.0) database. The following code works. ************************************************* <% Set Conn = Server.CreateObject("ADODB.Connection") Set objRS = Server.CreateObject("ADODB.RecordSET") value ="DRIVER=SQL Server;SERVER=TRYSQL;UID=yy;pwd=rabbit;DATABASE=moon" Conn.Open( value) sq = " SELECT Salary, Name FROM Data_Sal Where( Data_Sal.Locname ='COLUMBIA' AND Data_Sal.Year = 1997)" set objRS = Conn.Execute(sq) SET CHART1 = SERVER.CreateObject("CHARTFX.WEBSERVER") CHART1.AdoResultset objRS %> <% =CHART1.GETHTMLTAG(500,350) %> ************************************************* My problem is that I need to incorporate the fields from the form into the sql statment and then display the chart for the fields I choose. For example: I have a list box LOCATION_NAME: I select a particular LOCATION from the list box and click on a button (on_buttonclick event) that selection must be used in the above SQL statment "sq" instead of 'COLUMBIA' that I used above How do I do that. I tried using the statments below in the code shown above. **************************************** sq = " SELECT Salary, Name FROM Data_Sal Where ( Data_Sal.Locname ='"+Listbox1.getValue(Listbox1.selectedIndex)+"' AND Data_Sal.Year = 1997)" *************************************** but it doesn't work, any suggestions. I am using: InterDev 6.0 and MS-SQL 7.0 to develop this application. Thanks Ravi Link to comment Share on other sites More sharing options...
User (Legacy) Posted December 27, 1999 Author Report Share Posted December 27, 1999 Hi, I am try to draw some graphs using the output I get from querying a MS-SQL (7.0) database. The following code works. ************************************************* <% Set Conn = Server.CreateObject("ADODB.Connection") Set objRS = Server.CreateObject("ADODB.RecordSET") value ="DRIVER=SQL Server;SERVER=TRYSQL;UID=yy;pwd=rabbit;DATABASE=moon" Conn.Open( value) sq = " SELECT Salary, Name FROM Data_Sal Where( Data_Sal.Locname ='COLUMBIA' AND Data_Sal.Year = 1997)" set objRS = Conn.Execute(sq) SET CHART1 = SERVER.CreateObject("CHARTFX.WEBSERVER") CHART1.AdoResultset objRS %> <% =CHART1.GETHTMLTAG(500,350) %> ************************************************* My problem is that I need to incorporate the fields from the form into the sql statment and then display the chart for the fields I choose. For example: I have a list box LOCATION_NAME: I select a particular LOCATION from the list box and click on a button (on_buttonclick event) that selection must be used in the above SQL statment "sq" instead of 'COLUMBIA' that I used above How do I do that. I tried using the statments below in the code shown above. **************************************** sq = " SELECT Salary, Name FROM Data_Sal Where ( Data_Sal.Locname ='"+Listbox1.getValue(Listbox1.selectedIndex)+"' AND Data_Sal.Year = 1997)" *************************************** but it doesn't work, any suggestions. I am using: InterDev 6.0 and MS-SQL 7.0 to develop this application. Thanks Ravi Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.