I am new to access and asp, and have tried to make a query to one existing access database in our web portal.
While trying to get in the database "Users" and the Query "bursdag" (That I made - to get BirthDay (Date/time) and UserName).
I am trying to get the BirthDay day and month and compare them with todays so it prints the UserName and a birthday greeting...
This is what I got so far:
<%
dag = day(now)
mnd = month(now)
OpenDB sConnUsers
sSQL = "SELECT * FROM bursdag WHERE BirthDay = " & formatdatetime((now),vbshortdate)
rs.Open sSQL,,,adCmdTable
if rs.eof or rs.bof then
response.write "Ingen har bursdag i dag<br>"
end if
do while not rs.eof and not rs.bof
hvem = rs("UserName"
dagen = rs("BirthDate"
If ((day(dagen) = day(dag)) AND (month(dagen)) = month(mnd)) then
Response.write(" & hvem & ""har bursdag "" & BirthDay>"
end if
rs.movenext
loop
rs.close
%>
This is the error I get: (We have someone with birthday today..)
Microsoft JET Database Engine error '80040e14'
Syntax error in number in query expression 'BirthDay = 03.09.2002'.
While trying to get in the database "Users" and the Query "bursdag" (That I made - to get BirthDay (Date/time) and UserName).
I am trying to get the BirthDay day and month and compare them with todays so it prints the UserName and a birthday greeting...
This is what I got so far:
<%
dag = day(now)
mnd = month(now)
OpenDB sConnUsers
sSQL = "SELECT * FROM bursdag WHERE BirthDay = " & formatdatetime((now),vbshortdate)
rs.Open sSQL,,,adCmdTable
if rs.eof or rs.bof then
response.write "Ingen har bursdag i dag<br>"
end if
do while not rs.eof and not rs.bof
hvem = rs("UserName"
dagen = rs("BirthDate"
If ((day(dagen) = day(dag)) AND (month(dagen)) = month(mnd)) then
Response.write(" & hvem & ""har bursdag "" & BirthDay>"
end if
rs.movenext
loop
rs.close
%>
This is the error I get: (We have someone with birthday today..)
Microsoft JET Database Engine error '80040e14'
Syntax error in number in query expression 'BirthDay = 03.09.2002'.