RecordCount & CursorLocation (SQL)
Hi,
I'm quite new to using SQL and I'm trying to get a query going from Javascript into a database (everything is being done client-side on one machine). The problem I'm having is that I can't get a count of the records in the database, I get a return of -1. Here is the code:
<script language = "javascript">
var cString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\\Clevedon.mdb";
var adOpenForwardOnly = 0;
var adLockReadOnly = 1;
var adCmdText = 1;
var adUseClient = 1;
var tdStr = ""
var thStr = ""
var cObj = new ActiveXObject("ADODB.Connection");
var rSet = new ActiveXObject("ADODB.Recordset");
var qString="SELECT Categories.`Category Id`, Categories.`Category Name`, Categories.Deleted, Jobs.Priority, Jobs.`Logged at`, Jobs.`Next User Id`, Jobs.Notes, Categories.`Category Name`, Categories.`Category Id`, Categories.Deleted, Categories.`Category Name`, Categories.`Category Id`, Categories.`Category Name`, Categories.Deleted, Jobs.`Job Id`, Jobs.`Customer Id`, Jobs.`Category Id`, Jobs.Priority, Jobs.`Logged at`, Jobs.`To complete by`, Jobs.`Completed on`, Jobs.`Next User Id`, Jobs.Notes, Jobs.`Hours Spent`, Jobs.Problem, Jobs.Solution, Jobs.`To do`, Jobs.Cost, Jobs.`Completed on` FROM `C:\\CLEVEDON`.Categories Categories, `C:\\CLEVEDON`.Jobs Jobs WHERE Categories.`Category Id` = Jobs.`Category Id`"; //sql string to use (no probs with this so you can ignore
cObj.Open (cString); //open a connection
rSet.CursorLocation = adUseClient //trying to set cursor location to be client
rSet.Open(qString,cObj,adOpenForwardOnly,adLockRea dOnly,adCmdText);
alert(rSet.CursorLocation)//this comes back as client
alert(rSet.RecordCount)//comes back -1
for (i = 1; i < rSet.Fields.Count; i++)
{
thStr+= " <td> " + rSet.Fields(i).Name + "</td>"
}
for (j = 1; j < rSet.Fields.Count; j++)
{
tdStr += "<td> " + rSet.Fields(j).Value + "</td>"
}
rSet.Close(); //close the recordset
cObj.Close(); //close the connection
document.write ("<table><tr>" + thStr + "</tr><tr>" + tdStr + "</tr></table>")
</script>
When I googled the problem I'm having it returns results saying that I need the CursorLocation to be set to client, as "Dynamic Cursors" don't support RecordCount. I've tried to set the CursorLocation to be client, but I'm still getting the same result of -1?
Any help always much appreciated
Thanks
Joe
'sync' <cr>
The name specified is not recognized as an internal or external command, operable program or batch file.
__________________
\'sync\' <cr>
The name specified is not recognized as an internal or external command, operable program or batch file.
|