Forum Moderators: open
Here is my codes? where is the mistake?
<% comdate = Date %>
<% sqltemp = "select*from news where recorddate = "& comdate &" order by haber_id desc " %>
<% sqltemp = "select*from news where recorddate = #" & comdate &"# order by haber_id desc" %>
comdate ="#"& date & "#"
sqltemp = "Select * from news where recorddate = " & comdate
sqltemp = sqltemp& "order by haber_id desc"
Error Types
Microsoft OLE DB Provider for SQL Server (0x80040E14)
Line 1: Incorrect syntax near .04. or ‘#’
Error Type:
Microsoft VBScript runtime (0x800A00D)
Type mismatch:’Format’
And i tried another code examples in the form but i get error. I solved the problem. I assign date type in SQL Server as a not “smalldatetime” or “datettime” i assigned “int”
and then i use this blow the function and then solved the problem, but i couldn’t portray this solve
Still i dont understand why i dont use as a date type? Thanks for helping.
Here is my code.
Function TarihCevir(Tarih,CevirmeTipi)
Dim Gun, Ay, Yil
Select Case CevirmeTipi
Case "Tarih"
Gun=Mid(Tarih,7,2)
Ay=Mid(Tarih,5,2)
Yil=Mid(Tarih,1,4)
TarihCevir=Gun&"."&Ay&"."&Yil
Case "Rakam"
Gun=Mid(Tarih,1,2)
Ay=Mid(Tarih,4,2)
Yil=Mid(Tarih,7,4)
TarihCevir=Gun&Ay&Yil
CASE "TR"
Gun=Mid(Tarih,4,2)
Ay=Mid(Tarih,1,2)
Yil=Mid(Tarih,7,4)
TarihCevir=Gun&"."&Ay&"."&Yil
CASE "USA"
Gun=Mid(Tarih,1,2)
Ay=Mid(Tarih,4,2)
Yil=Mid(Tarih,7,4)
TarihCevir=Ay&"/"&Gun&"/"&Yil
Case Else
TarihCevir=Tarih
End Select
End Function
Tarihim=Date()
Bugun=TarihCevir(Tarihim,"Rakam")
SQL = "SELECT * FROM news WHERE tarih = "&Bugun&""
SQL = SQL& "ORDER BY haber_id desc"
Whenever I get stuck I refer to this guide, very good info:
[aspfaq.com...]