473,322 Members | 1,379 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

How To Accesss Ms Sql Databse Usin Activexobject

HI,
I AM TRYING TO ACCESS MS SQL 2005 DATABASE THROUGH JAVASCRIPT BUT IT GIVING ME RUNTIME ERROR.


Expand|Select|Wrap|Line Numbers
  1. <SCRIPT type="text/javascript">
  2. <!--
  3. function Aufruf(){
  4. var rst;
  5. var dsn;
  6. var sql;
  7. var newWindow;
  8. try
  9. {
  10. var rst = new ActiveXObject("ADODB.Recordset");
  11. var connection = new ActiveXObject("ADODB.Connection");
  12. connection.Open ("Provider=SQLOLEDB.1;Persist Security Info=False;UserID=myID;Initial Catalog=Projekt;Data Source=MyServer;pwd=mypass");
  13. sql = ("select moiveId, title from movie");
  14. rst.Open (sql, dsn);
  15. newWindow = window.open("","","width=600, height=400,top=200
  16. left=200,scrollbars");
  17. while (!rst.EOF){
  18. newWindow.document.write(rst(0) + " " + rst (1));
  19. newWindow.document.write("<br>");
  20. rst.moveNext();
  21.  
  22. rst.Close();
  23. }
  24. catch{
  25.   txt="There was an error on this page.\n\n"
  26.   txt+="Error description: " + err.description + "\n\n"
  27.   txt+="Click OK to continue.\n\n"
  28.   alert(txt)
  29.   }
Nov 27 '07 #1
3 3841
mzmishra
390 Expert 256MB
As far I know JavaScript basically being a client side language cannot access a database which is usually in a server. A server side lang such as CGI, PHP, JSP, ASP or similar need to be used. Or you can use AJAX
Nov 27 '07 #2
acoder
16,027 Expert Mod 8TB
HI,
I AM TRYING TO ACCESS MS SQL 2005 DATABASE THROUGH JAVASCRIPT BUT IT GIVING ME RUNTIME ERROR.
What kind of runtime error?

PS. please don't use only caps when typing - it looks like you're shouting!
Nov 27 '07 #3
acoder
16,027 Expert Mod 8TB
As far I know JavaScript basically being a client side language cannot access a database which is usually in a server. A server side lang such as CGI, PHP, JSP, ASP or similar need to be used. Or you can use AJAX
JavaScript can't access a database, but ActiveX can. However, it's only supported by IE.
Nov 27 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Nomad | last post by:
I'm trying to load an XML document into the DOM using the ActiveXObject I've succeeded in doing this on one machine. Which shouldn't becaus I've checked for the ActiveXObject and it doesn't...
2
by: Peter Kirk | last post by:
Hi there, I am having trouble with ActiveXObject. I have a function which includes this snippet: alert('INIT 1'); orgdoc = new ActiveXObject('Microsoft.XMLDOM'); alert('INIT 2'); I see...
0
by: ndronen | last post by:
Hi: I have a DLL compiled from C# that I have to be able to use within an HTML document. This is relatively easy to do following the suggestions on this page: ...
0
by: RamyaKarthik | last post by:
pls give some guide lines for developing project for online survey usin c++
43
by: shaanxxx | last post by:
if u give cordinates to programme at run time and want a line to be drawn.. how to do this in c without usin any graphics function? like x1,y1 and x2,y2 and lines should be drawn from the 1st...
11
by: tokcy | last post by:
Hi everyone, I am new in php and ajax, i am facing the prob while i click on element of first drop down then in second dropdown all element showl come from database. I mean i have three dropdown 1....
3
by: Sunny | last post by:
In IE, we can open an access database uing an Active X Object. How I can do the same in Firefox. As Firefox, dont allow you to create a Active X Object. Here is the IE Code. var myConnect =...
11
by: nitinsingh1 | last post by:
Hi, I am using ActiveXobject as var xp = new ActiveXObject("WPrint.PrintCtl"); in my JSP application. I have heard that using ActiveXobject may be dangerous for my application as i am using...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.