Hi,
I have a table in Pervasive SQL. I am accessing it from ASP and getting certain fileds. I want the date field to be printed in MM/DD/YYYY format, whereas in the database it is stored as YYYYMMDD. How do I get around it.
set conn = server.createobject("adodb.connection")
set rs = Server.CreateObject("ADODB.recordset")
ConnectionString = " DRIVER={Pervasive ODBC Client Interface};ServerName=ntserver;DBQ=Quantum;DefaultDir=;UID=;PWD=;"
conn.open ConnectionString
rs.open "select OePo_Item.ITEM_ID,OePo_Item.DESC_1,convert(left(OePo_Header.PO_DATE,4)" & '-'& "right(left(OePo_Header.PO_DATE,6),2)" & '-' & "right (OePo_Header.PO_DATE,2),pdate) from OePo_Item,OePo_Header order by OePo_Item.REQUIRED_DATE,OePo_Item.ACKNOWLEDGE_DATE",conn
%>
<% while not rs.EOF %>
<tr>
<% For each item in rs.Fields %>
<td nowrap style="font-family:verdana; font-size:8px"><%Response.Write (item.value) %></td>
<% next
rs.MoveNext%>
</tr>
<% wend
rs.close
set rs = nothing
Conn.close
Set conn = nothing
%>
I tried both convert and cast functions and it gives an error. The error it gives is
Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Pervasive][ODBC Client Interface][LNA][Pervasive][ODBC Engine Interface]The second parameter pdate for CONVERT is invalid.
I am using Pervasive Sql version 8. Any help would be appreciated.
Thanks
I have a table in Pervasive SQL. I am accessing it from ASP and getting certain fileds. I want the date field to be printed in MM/DD/YYYY format, whereas in the database it is stored as YYYYMMDD. How do I get around it.
set conn = server.createobject("adodb.connection")
set rs = Server.CreateObject("ADODB.recordset")
ConnectionString = " DRIVER={Pervasive ODBC Client Interface};ServerName=ntserver;DBQ=Quantum;DefaultDir=;UID=;PWD=;"
conn.open ConnectionString
rs.open "select OePo_Item.ITEM_ID,OePo_Item.DESC_1,convert(left(OePo_Header.PO_DATE,4)" & '-'& "right(left(OePo_Header.PO_DATE,6),2)" & '-' & "right (OePo_Header.PO_DATE,2),pdate) from OePo_Item,OePo_Header order by OePo_Item.REQUIRED_DATE,OePo_Item.ACKNOWLEDGE_DATE",conn
%>
<% while not rs.EOF %>
<tr>
<% For each item in rs.Fields %>
<td nowrap style="font-family:verdana; font-size:8px"><%Response.Write (item.value) %></td>
<% next
rs.MoveNext%>
</tr>
<% wend
rs.close
set rs = nothing
Conn.close
Set conn = nothing
%>
I tried both convert and cast functions and it gives an error. The error it gives is
Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Pervasive][ODBC Client Interface][LNA][Pervasive][ODBC Engine Interface]The second parameter pdate for CONVERT is invalid.
I am using Pervasive Sql version 8. Any help would be appreciated.
Thanks