![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
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 % |
#3
| |||
| |||
|
|
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 % |
![]() |
| Thread Tools | |
| Display Modes | |
| |