Re: Why doesn't this work? ASP -> SQL Server 2008 Select Distinct
- From: "Mark B" <marximus27@xxxxxxxxxxx>
- Date: Wed, 29 Jul 2009 21:30:01 +1000
Phew! Fixed it.
There was an issue with my connectivity string.
"Mark B" <marximus27@xxxxxxxxxxx> wrote in message
news:%23%234KThDEKHA.5780@xxxxxxxxxxxxxxxxxxxxxxx
This is in an ASP script, as I try to get unique classcodes
(StudentClassCode column) in the StudentData table.
Doesn't matter what I try in ASP, it stubbornly says Incorrect syntax near
the keyword 'Select'.
And yet this works fine in the MS SQL Server 2008 Querier console:
SELECT distinct [StudentClassCode]
FROM [StudentTimetable].[dbo].[StudentData] Order By StudentClassCode ASC
Ok, so there's a bit extra there, but even pasting this above in to the
ASP doesn't work!
Liddlebittahelp, please.
Thanks all,
Mark
<%
Dim conn
Dim rs
Dim cst
cst="Provider=SQLOLEDB.1;Data Source=myServer;Initial
Catalog=StudentTimetable;Network=DBMSSOCN;User Id=myID;password=myPW"
set conn=CreateObject("ADODB.Connection")
Set rs=Server.CreateObject("ADODB.Recordset")
conn.Open cst
rs.Open "Select distinct StudentClassCode FROM StudentData Order By
StudentClassCode ASC", conn, 1, 3, 2
rs.movefirst
Do while not rs.eof
response.write rs.fields("StudentClassCode")
rs.movenext
Loop
rs.close
conn.close
%>
.
- References:
- Prev by Date: Why doesn't this work? ASP -> SQL Server 2008 Select Distinct
- Next by Date: Re: Why doesn't this work? ASP -> SQL Server 2008 Select Distinct
- Previous by thread: Why doesn't this work? ASP -> SQL Server 2008 Select Distinct
- Next by thread: Re: Why doesn't this work? ASP -> SQL Server 2008 Select Distinct
- Index(es):
Relevant Pages
|