/    Sign up×
Community /Pin to ProfileBookmark

JavaScript button to open database??

Hi!
I just wanted to know how to create a button in JavaScript that will execute 2 functions in JavaScript. The button when clicked should verify (or reject) a password entered by the user (i.e Check it against a password previously stored in the database). If verified then the button should open MS Access giving the database administrator access to the database for adding, editing deleting records etc..
Any help would be much appreciated!!
Thanks alot,
Roddy

to post a comment
JavaScript

5 Comments(s)

Copy linkTweet thisAlerts:
@pyroFeb 14.2003 — JavaScript can not connect to a database. You will need a server side language such as PHP, Perl, or ASP to do this.
Copy linkTweet thisAlerts:
@khalidali63Feb 14.2003 — JavaScript without then help of hard core prgramming languages (C/C++,Java) is will not be able to do this task.( you can not access system resources with JavaScript)

cheers

Khalid
Copy linkTweet thisAlerts:
@PortmoonauthorFeb 14.2003 — Thanks for replying!!

Does this mean that it is not possible to transpose this VBScript to Javascript to enable client side scripting.

Does the following code 'have' to be executed on a server in order for it to access the database???

Thanks


<%

Dim accessDb, myDSN, dbConnection, dbQuery, recordSet

accessDb = "myDatabase.mdb"

myDSN = "Driver={Microsoft Access Driver (*.mdb)};

myDSN = myDSN & "DBQ=" & server.mappath(accessDb)

Set dbConnection = Server.CreateObject("ADODB.Connection")

Set rsRecordSet = Server.CreateObject("ADODB.RecordSet")

dbQuery = "SELECT * FROM myDatabase ORDER BY name "

Set recordSet = dbConnection.Execute(dbQuery)



if not((rsRecordSet.EOF) OR (rsRecordSet.BOF)) then

Response.Write("<h1>no records found in the database<h1>")

else

rsRecordSet.MoveFirst
while not(rsRecordSet.EOF){
Response.Write(RecordSet("name") &_
"(" & recordSet("number") &

")<br>")

rsRecordSet.MoveNext

loop

end if

rsRecordSet.Close

dbConnection.Close
Copy linkTweet thisAlerts:
@pyroFeb 14.2003 — [i]Originally posted by Portmoon [/i]

[B]Does the following code 'have' to be executed on a server in order for it to access the database???[/B][/QUOTE]
Yes, the database query has to be executed server side. You can, however, move the values into javascirpt something like the following

&lt;script language="javascript" type="text/javascript"&gt;
var test = "&lt;%= aspvar %&gt;"
&lt;/script&gt;


NOTE: I don't know any ASP, so the above was just a guess on syntax, but I wanted to show you it is possible. ?
Copy linkTweet thisAlerts:
@PortmoonauthorFeb 15.2003 — Thanks again 'Pyro' for your advice, this clarifies a few doubts I had regarding JavaScript!

Cheers,

?
×

Success!

Help @Portmoon spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...