ADO를 사용하여 데이터베이스를 조작하는 방법을 배우려고합니다. 그래서 이것은 매우 기본적인 질문이지만 계속 도움이 필요하다는 것을 알고 있습니다. 나는 SQL 쿼리 분석기에서 쿼리를 실행하고 그것을 잘 실행 : ADO와 함께 사용할 때 sql 쿼리가 작동하지 않습니다.
SELECT TOP 1 QuestionType FROM Questions
ORDER BY QuestionID DESC;
그러나 내 ADO 스크립트에 넣어 노력하고 내가 쿼리 늘 완전한 오류를 얻었다. 누군가 왜 저에게 말할 수 있습니까? 다시 간단한 구문 오류 일 경우 죄송합니다. 다음은 오류를주고있다이 스크립트입니다
set rs=Server.CreateObject("ADODB.recordset")
rs.Open "Select * from Questions", conn
sql="INSERT INTO Questions(QuestionText, QuestionType)"
sql=sql & " VALUES "
sql=sql & "('" & qtext & "',"
sql=sql & "'" & "test" & "');"
sql=sql & "SELECT TOP 1 QuestionID FROM Questions"
sql=sql & "ORDER BY QuestionID DESC;"
on error resume next
conn.Execute sql,recaffected
if err<>0 then
Response.Write("An Error Has Occured")
else
Response.Write(rs(0))
end if
당신은 공간 ORDER (한 전 후 필요