ODBC

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am developing an ASP application. Development using the followings:

Mashine Windows XP SP2
Database SQL Server 2000 Developer Edition
Connection using DSN - ODBC

Problem

One of my table is used to keep transaction including the date of
transaction - data type datetime. When I tried to quey the table using a
date as a condition I got this message:

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E07)
[Microsoft][ODBC SQL Server Driver][SQL Server]The conversion of a char data
type to a datetime data type resulted in an out-of-range datetime value.
/zakatnet/laporanHarianRingkasan.asp, line 12

This is my asp statement:

........................
<%
if request.form("tarikh")="" then
response.Redirect("laporanharianGetdate.asp")

tarikh=CDate(request.form("tarikh"))
sqlstmt = "select * from Penyata where TarikhBayaran= '" & (tarikh) & "'"
set byr = conn.execute(sqlstmt)
%>

...............

Note: When I used anothr machine - using Windows 2000 Pro and sama db
Server, it work.s

Need help on this.
 
wira659 said:
I am developing an ASP application. Development using the followings:

Mashine Windows XP SP2
Database SQL Server 2000 Developer Edition
Connection using DSN - ODBC

Problem

One of my table is used to keep transaction including the date of
transaction - data type datetime. When I tried to quey the table using a
date as a condition I got this message:

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E07)
[Microsoft][ODBC SQL Server Driver][SQL Server]The conversion of a char
data
type to a datetime data type resulted in an out-of-range datetime value.
/zakatnet/laporanHarianRingkasan.asp, line 12

This is my asp statement:

.......................
<%
if request.form("tarikh")="" then
response.Redirect("laporanharianGetdate.asp")

tarikh=CDate(request.form("tarikh"))
sqlstmt = "select * from Penyata where TarikhBayaran= '" & (tarikh) & "'"
set byr = conn.execute(sqlstmt)
%>

..............

Note: When I used anothr machine - using Windows 2000 Pro and sama db
Server, it work.s

Need help on this.

Your XP machines local date format is not US, and SQL server is having
trouble converting your date, eg. in UK format 28 Feb 2005 would be
28/02/2005, and SQL server would read this as the 2nd day of the 28th month
in the year 2005, which is not valid. Dates should always be converted to
the SQL internal format (eg. '2005-02-28T11:10:10' for 28th Feb 2005
11:10:10 am) to avoid this problem.

Dan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top