Welcome, Guest ( Customer Panel | Login )




 All Forums
 VPCart Forum
 General help me questions
 Date Fromat Problem MSSQL 2005
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Steve2507
VP-CART Expert

590 Posts

Posted - November 19 2011 :  13:54:33  Show Profile  Reply with Quote
Hi,

We are in the process of moving servers and the new server has MSSQL 2005 (we are currently using MSSQL 2000).

Everything is going fine apart from a problem with the date format.

For the also bought feature we are getting the following error:
Microsoft OLE DB Provider for ODBC Drivers error '80040e07' 
[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. 
/shopalsobought.asp, line 142

The code it is referring to is this:
Sub Getalsoboughtproducts (incatalogid, productlist)
dim orderdbc, orderlist, ordermax, count, productmax, catalogid
dim orderdate, sql, rc, rs, orderid, months
orderlist=""
productlist=""
months=getconfig("xalsoboughtmonths")
if months="" then months=12
orderdate =dateadd("m",-months,date())
count=0
ordermax=50
productmax=50
' bypass if mysql which cannot handle sql  HK
' xxx

openorderdb orderdbc
sql="SELECT oitems.catalogid, orders.orderid FROM orders "
sql=sql &  " INNER JOIN oitems ON orders.orderid = oitems.orderid "
sql=sql &  " WHERE (orders.odate>=" & datedelimit(orderdate) 

	'VP-ASP 6.50 - show parent product instead of child product
	dim ishighersql, ishigherrs
	ishighersql = "select hassubproduct from products where catalogid = " & incatalogid
	set ishigherrs=orderdbc.execute(ishighersql)
	if not ishigherrs.eof then
		if ishigherrs("hassubproduct") = "Yes" then
			sql=sql &  "  AND oitems.catalogid IN (select catalogid from products WHERE highercatalogid = " & incatalogid & "))"
		else
			sql=sql &  "  AND oitems.catalogid=" & incatalogid & ")"
		end if
	else
		sql=sql &  "  AND oitems.catalogid=" & incatalogid & ")"
	end if

	closerecordset ishigherrs

'debugwrite sql
set rs=orderdbc.execute(sql)

Line 142 refers to the last line in the above code.

Pulling my hair out at this so any help appreciated.


Steve
Sex toys from a UK sex shop including vibrators and dildos.

Steve2507
VP-CART Expert

590 Posts

Posted - November 19 2011 :  15:57:38  Show Profile  Reply with Quote
Worked it out.

The problem is the datedelimit. It needs to be avoided with MSSQL 2005


Steve
Sex toys from a UK sex shop including vibrators and dildos.
Go to Top of Page

diegomilito
VP-CART Expert

Argentina
779 Posts

Posted - January 14 2012 :  02:35:15  Show Profile  Reply with Quote
Hey, steve, it is usually date format in the server issue from your initial read. How did you solve it anyway ?

Diego.
Go to Top of Page

marcop
Starting Member

Italy
7 Posts

Posted - February 27 2018 :  04:13:15  Show Profile  Reply with Quote
Has anyone solved? I duplicate a running website on my pc for debug but now raise this problem... The date format is the same that on server but on my pc with win 7 and dd/MM/yyyy I got the error...
Go to Top of Page

swampthink
VP-CART New User

106 Posts

Posted - February 27 2018 :  06:33:49  Show Profile  Reply with Quote
I found this article from microsoft hope can help

https://support.microsoft.com/en-us/help/861801/error-the-conversion-of-a-char-data-type-to-a-datetime-data-type-resul
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Snitz Forums 2000
0 Item(s)
$0.00