OK. What am I doing wrong here? I am trying to get all the records in the Knowledge table that match Software Category. Each record has a different category (software, hardware, microsoft stuff, etc), and I want to retreive that and diplay the total # of Q&As found. Anyone can help me here please:
<%
'here's the connection to the mdb
Dim myConnSoftware,myPathSoftware
Set myConnSoftware = Server.CreateObject("ADODB.Connection"
myPathSoftware = Server.MapPath("/Databases/Knowledge.mdb"
myConnSoftware.Open "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & myPathSoftware & ";"
'now we will set up an sql statement to do the counting
Dim mySQLSoftware
mySQLSoftware = "Select Count(*) AS Software FROM Knowledge Where Category= '" & Software & "'"
'here's a recordset being setup to run the connection
'and to run the sql statement thus doing all our math
Dim myRSSoftware
Set myRSSoftware = Server.CreateObject("ADODB.RecordSet"
myRSSoftware.Open mySQLSoftware, myConnSoftware
'and now we write it to the page
Response.Write myRSSoftware("Software"
' and we ALWAYS want to close our connections and recordsets!!!
myRSSoftware.Close
Set myRSSoftware = Nothing
myConnSoftware.Close
Set myConnSoftware = Nothing
%>
I also had the code this way, and still didnt work, same as above but with the Select statement different:
mySQLSoftware = "Select Distinct Count(Category) AS Software FROM Knowledge Where Category= '" & Software & "'"
And this way:
mySQLSoftware = "Select Distinct Count(Category) AS Software FROM Knowledge"
mySQLSoftware = mySQLSoftware & " Where Category= '" & UltiPro & "'"
Everyway I put it, it gives me 0. I have different categories in each record, but want to get only records that has category Software or Hardware, etc etc.
Thank You For Your Help.
<%
'here's the connection to the mdb
Dim myConnSoftware,myPathSoftware
Set myConnSoftware = Server.CreateObject("ADODB.Connection"
myPathSoftware = Server.MapPath("/Databases/Knowledge.mdb"
myConnSoftware.Open "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & myPathSoftware & ";"
'now we will set up an sql statement to do the counting
Dim mySQLSoftware
mySQLSoftware = "Select Count(*) AS Software FROM Knowledge Where Category= '" & Software & "'"
'here's a recordset being setup to run the connection
'and to run the sql statement thus doing all our math
Dim myRSSoftware
Set myRSSoftware = Server.CreateObject("ADODB.RecordSet"
myRSSoftware.Open mySQLSoftware, myConnSoftware
'and now we write it to the page
Response.Write myRSSoftware("Software"
' and we ALWAYS want to close our connections and recordsets!!!
myRSSoftware.Close
Set myRSSoftware = Nothing
myConnSoftware.Close
Set myConnSoftware = Nothing
%>
I also had the code this way, and still didnt work, same as above but with the Select statement different:
mySQLSoftware = "Select Distinct Count(Category) AS Software FROM Knowledge Where Category= '" & Software & "'"
And this way:
mySQLSoftware = "Select Distinct Count(Category) AS Software FROM Knowledge"
mySQLSoftware = mySQLSoftware & " Where Category= '" & UltiPro & "'"
Everyway I put it, it gives me 0. I have different categories in each record, but want to get only records that has category Software or Hardware, etc etc.
Thank You For Your Help.