View Single Post
  #1 (permalink)  
Old September 7th, 2005, 04:43 PM
panuvin panuvin is offline
Authorized User
 
Join Date: Sep 2005
Location: , , .
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Default Javascript Access Database Query

I'm having trouble getting all the syntax and parameters complete for a database lookup function in javascript. I'm used to programming in ASP and VBScript, but the javascript is throwing me off a little bit. Can anyone tell what is wrong with this code? It is giving me an error saying the connection string is incorrect. I've tried several variations, but it won't work. Also, it is having a problem with Server not being an object; do I need to use 'new'? Here is the code:

Code:
function dblookup()
{
    var myConnect = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=db\\sdi.mdb"; 

    var ConnectObj = Server.CreateObject("ADODB.Connection");
    var RS = Server.CreateObject("ADODB.Recordset");
    var sql="SELECT * FROM employeespulled WHERE empid='1';";

    ConnectObj.Open (myConnect);
    RS.Open(sql,ConnectObj,adOpenForwardOnly,adLockReadOnly,adCmdText);

    var recordCount = RS.Fields.Count;
    alert ("recordCount" + recordCount);
    //RS.Fields(x).Name
}
Thanks in advance!

Panuvin

Reply With Quote