Software FX Posted December 27, 1999 Report Share Posted December 27, 1999 Please note that this question is completely independent of our product since you would need to do this even if the SQL statement is being dumped into the HTML page (without using any charts). It seems to me that you are trying to use the name of an object (listbox1) on the server when this object lives only on the client, if you are using an HTML form, parameters are passed as part of the request and you typically access them using the IIS Request object. I would recommend you take a look at the samples included with IIS and read more about the Request object (IIS documentation) Regards, Juan Cegarra Software FX, Inc. http://support.softwarefx.com -----Original Message----- From: Ravi Madhira [ mailto:rmadhira@even.tamuk.edu] Posted At: Monday, December 27, 1999 7:23 AM Posted To: Server Conversation: Incorporating listbox selections into sql statment Subject: Incorporating listbox selections into sql statment 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...
Software FX Posted December 27, 1999 Author Report Share Posted December 27, 1999 Please note that this question is completely independent of our product since you would need to do this even if the SQL statement is being dumped into the HTML page (without using any charts). It seems to me that you are trying to use the name of an object (listbox1) on the server when this object lives only on the client, if you are using an HTML form, parameters are passed as part of the request and you typically access them using the IIS Request object. I would recommend you take a look at the samples included with IIS and read more about the Request object (IIS documentation) Regards, Juan Cegarra Software FX, Inc. http://support.softwarefx.com -----Original Message----- From: Ravi Madhira [ mailto:rmadhira@even.tamuk.edu] Posted At: Monday, December 27, 1999 7:23 AM Posted To: Server Conversation: Incorporating listbox selections into sql statment Subject: Incorporating listbox selections into sql statment 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.