Web Analytics Made Easy -
StatCounter How to connect database using Javascript in ASP page ? - CodingForum

Announcement

Collapse
No announcement yet.

How to connect database using Javascript in ASP page ?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to connect database using Javascript in ASP page ?

    Hello Everyone,

    I am using Javascript in ASP page to connect to the database. I am not able to figure out where is the problem.
    Gettting this error->
    Error Type:
    Microsoft OLE DB Provider for SQL Server (0x80004005)
    [DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied.
    /MyWeb/test.asp, line 9
    My code is->
    Code:
    <%@ Language = JavaScript %>
    <%
          var myconnection
          var myrecordset
          var connectionString
    
          myconnection = Server.CreateObject("adodb.connection")
          connectionString = "Provider=SQLOLEDB.1;Password=myPwd;Persist Security Info=True;User ID=myId;Initial Catalog=MyTable;Data Source=MyCompName\MyDBINSTANCE"
          myconnection.Open(connectionString, myconnection);
    
    %>
    If someone could please guide me in the right direction I would greatly apprieciate it.

    Thanking You.
Working...
X