Click to See Complete Forum and Search --> : How to Execute a SQL Server's Stored Procdure from Javascript(JS)


AbrarNazeer
March 18th, 2008, 04:49 AM
How to get a scalar value output by Executing a SQL Server's Stored
Procdure from Javascript(JS) file.
Although there are some examples on internet with Server object i.e
Server.CreateObject("ADODB.connection")
but i m seeing the error "Server is undefined". If i put this code on a
web page (e.g aspx - asp.net 2.0 ) then it will work fine.
But my requirement is to Execute this code from JS file.
( JS file is called by an HTML page via a Script tag.
<script type="text/javascript" src="myFile.js"></script>
)

PeejAvery
March 18th, 2008, 07:07 AM
By putting it into a JS file, you are attempting to make the client machine access your SQL server. The client itself does not have that ability. It must be executed by the server-side code or else it cannot access the server.