PDA

Click to See Complete Forum and Search --> : Calling a database using JS


hpl
Apr 8th, 2002, 07:29 AM
I wish to make a database call with a JS-function. I have tried to use the code coming from SCOUT, but I had no succes, what am I doing wrong?

function LngText(TextID,Language) {
Language = 1;
TextID = 1;
'if you have language columns
objRS= "SELECT "& Language &" FROM Generelt WHERE ID="&TextID&";",dpd_sprog.mdb
'if you have langauge tables
objRS= "SELECT text FROM "&Language&" WHERE ID="&TextID&";",dpd_sprog.mdb

LngText=objRS
document.navform.text21.value = LngText
end function

scoutt
Apr 8th, 2002, 04:18 PM
huh I don't even know JS let alone ASP. didn't get it from me...

hpl
Apr 9th, 2002, 12:18 AM
SOrry, it was NETSCOUT2!

hpl
Apr 9th, 2002, 12:21 AM
But I must ask you, if you are familiar using ASP, can I solve my problem using a function in ASP? I have only used functions written in JS

mendhak
Apr 9th, 2002, 01:35 AM
I don't think you can use JS to access a database. You'll have to use a language ASP, or CGI or PHP.... to answer your question, yes, asp would help you.

hpl
Apr 9th, 2002, 01:43 AM
OK, thanks! Can I use the function above as a JS function? I think about the onClick-events and so on. The next question is, will the function above work in ASP?

punkpie_uk
Apr 9th, 2002, 03:15 AM
You can access a database with server-side JScript, but again thats related to ASP so you might as well us that