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!

Executing SQL Query With JavaScript Function

Status
Not open for further replies.

martim07

Technical User
Nov 6, 2004
9
US
Hi,

I need to have the result of this query: <% sqlString = "SELECT EASE_OF_USE.EASE_OF_USE_DESCRIPTION FROM EASE_OF_USE INNER JOIN QUESTION_1_PHP ON EASE_OF_USE.EASE_OF_USE_ID = QUESTION_1_PHP.EASE_OF_USE_ID"

SET RS = Con.Execute( sqlString )

%>
<%=RS( "EASE_OF_USE_DESCRIPTION" )%>

Display in a textarea when A user clicks on a button. I think that I need to write a function and then assign a variable to the onClick event, but I'm not used to programming at this level. I would appreciate any help with this.

Thanks
 
Javascript is a client-side language. That means that it cannot directly connect to a database. You will need to access the database through a server-side language. Options include:
[ul]
[li]Create a server-side page that outputs records to an XML file, and use Javascript and an embedded XML field to obtain records[/li]
[li]Refresh the page each time, contacting a server-side page[/li]
[/ul]
Those are the ones I can think of off the top of my head.

--Chessbot

"See the TURTLE of enormous girth!"
-- Stephen King, The Dark Tower series
 
Yes, I should have made that clear. I already have an active connection to the database. Would it be better to do a function with ASP?
 
How do you have an "active connection to the database"? Are you trying to output the values based on a user's input, or is this all before the page is loaded? If the latter, then yes, you should make an ASP function.

--Chessbot

"See the TURTLE of enormous girth!"
-- Stephen King, The Dark Tower series
 
I am retrieving data from the database in other areas of the page through ASP. I just have no idea on how to execute this with onClick. Thanks for your input. I have moved this question to the ASP forum.
 
There is no way to directly execute ASP code from a Javascript function. You must access the database some other way.

--Chessbot

"See the TURTLE of enormous girth!"
-- Stephen King, The Dark Tower series
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top