here4u247
asked on
Cannot display oracle date field in ASP: ODBC Drivers error '80020009'
Dear all,
I 'm getting an error whenever i want to display a date field in my ASP page, i read couple of solution this problem they all recommend to select the date field last in my sql command which i done but still i'm getting the same error which is:
Microsoft OLE DB Provider for ODBC Drivers error '80020009'
Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.
?
I can see all the field but when it comes to date field the error shown.
I'm using IIS, ASP with Oracle as DB, here is my sql command: Sqlquery = "Select ORDERID,SUPP_SUPPID,TOTAL, SORDER_DAT E from supp_orders S,INVOICES N where S.ORDERID <> N.SORDER_ORDERID"
full code is as follows:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
set objConn = server.createObject ("ADODB.connection")
Set Rs=Server.CreateObject("AD ODB.Record set")
objConn.Open "dsn=design01;uid=****;pwd =****;;"
Sqlquery = "Select ORDERID,SUPP_SUPPID,TOTAL, SORDER_DAT E from supp_orders S,INVOICES N where S.ORDERID <> N.SORDER_ORDERID"
Response.Write(Sqlquery)
Rs.open Sqlquery, objConn
%>
{HTML}
<table border="0">
<tr>
<th height="57" colspan="12">Orders </th>
</tr>
<tr>
<th>Order ID </th>
<th>Order Date</th>
<th>Supplier ID</th>
<th>Total</th>
<th>Action</th>
</tr>
<%
while not Rs.eof
%>
<tr>
<td><% response.write(Rs("ORDERID "))%> </td>
<td><% response.write(Rs("SORDER_ DATE"))%> </td>
<td><% response.write(Rs("SUPP_SU PPID"))%> </td>
<td><% response.write(Rs("TOTAL") )%> </td>
<td>View Item | Edit | Delete</td>
</tr>
<%
Rs.MoveNext
Wend
Rs.close
objConn.close
set Rs=nothing
Set objConn=nothing
%>
</table>
{HTML}
I 'm getting an error whenever i want to display a date field in my ASP page, i read couple of solution this problem they all recommend to select the date field last in my sql command which i done but still i'm getting the same error which is:
Microsoft OLE DB Provider for ODBC Drivers error '80020009'
Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.
?
I can see all the field but when it comes to date field the error shown.
I'm using IIS, ASP with Oracle as DB, here is my sql command: Sqlquery = "Select ORDERID,SUPP_SUPPID,TOTAL,
full code is as follows:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
set objConn = server.createObject ("ADODB.connection")
Set Rs=Server.CreateObject("AD
objConn.Open "dsn=design01;uid=****;pwd
Sqlquery = "Select ORDERID,SUPP_SUPPID,TOTAL,
Response.Write(Sqlquery)
Rs.open Sqlquery, objConn
%>
{HTML}
<table border="0">
<tr>
<th height="57" colspan="12">Orders </th>
</tr>
<tr>
<th>Order ID </th>
<th>Order Date</th>
<th>Supplier ID</th>
<th>Total</th>
<th>Action</th>
</tr>
<%
while not Rs.eof
%>
<tr>
<td><% response.write(Rs("ORDERID
<td><% response.write(Rs("SORDER_
<td><% response.write(Rs("SUPP_SU
<td><% response.write(Rs("TOTAL")
<td>View Item | Edit | Delete</td>
</tr>
<%
Rs.MoveNext
Wend
Rs.close
objConn.close
set Rs=nothing
Set objConn=nothing
%>
</table>
{HTML}
ASKER
hi Ajai,
i tried your solution by changing into:
Rs.open Sqlquery, objConn, 3, 3
but i got the same error:
Microsoft OLE DB Provider for ODBC Drivers error '80020009'
Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.
?
i tried your solution by changing into:
Rs.open Sqlquery, objConn, 3, 3
but i got the same error:
Microsoft OLE DB Provider for ODBC Drivers error '80020009'
Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.
?
Use alisas on the column names
I do not which one's coming from where, but basically somethign like that
Sqlquery = "Select N.ORDERID,S.SUPP_SUPPID,TO TAL,SORDER _DATE from supp_orders S,INVOICES N where S.ORDERID <> N.SORDER_ORDERID"
Make sure your use correct aliases in column names, otherwise you will get 'Item not found error'
I do not which one's coming from where, but basically somethign like that
Sqlquery = "Select N.ORDERID,S.SUPP_SUPPID,TO
Make sure your use correct aliases in column names, otherwise you will get 'Item not found error'
ASKER
hi jitganguly,
i tried what you suggested but i still have the same error when i want to display the date field:
Microsoft OLE DB Provider for ODBC Drivers error '80020009'
Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.
?
the modified code is now like this:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
set objConn = server.createObject ("ADODB.connection")
Set Rs=Server.CreateObject("AD ODB.Record set")
objConn.Open "dsn=design01;uid=****;pwd =****;"
'-----------jitganguly suggesting---------'
Sqlquery = "Select N.SORDER_ORDERID, S.ORDERID,S.SUPP_SUPPID,S. TOTAL,S.SO RDER_DATE from supp_orders S,INVOICES N where S.ORDERID <> N.SORDER_ORDERID"
'--------------------'
'-----------Ajai suggesting---------'
Rs.open Sqlquery, objConn, 3, 3
'--------------------'
%>
<table border="0">
<tr>
<th height="57" colspan="12">Products Details</th>
</tr>
<tr>
<th>Order ID </th>
<th>Order Date</th>
<th>Supplier ID</th>
<th>Total</th>
<th>Action</th>
</tr>
<%
while not Rs.eof
%>
<tr>
<td><% response.write(Rs("ORDERID "))%> </td>
<td><% response.write(Rs("SORDER_ DATE"))%> </td>
<td><% response.write(Rs("SUPP_SU PPID"))%> </td>
<td><% response.write(Rs("TOTAL") )%> </td>
<td>View Item | Edit | Delete</td>
</tr>
<%
Rs.MoveNext
Wend
Rs.close
objConn.close
set Rs=nothing
Set objConn=nothing
%>
i tried what you suggested but i still have the same error when i want to display the date field:
Microsoft OLE DB Provider for ODBC Drivers error '80020009'
Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.
?
the modified code is now like this:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
set objConn = server.createObject ("ADODB.connection")
Set Rs=Server.CreateObject("AD
objConn.Open "dsn=design01;uid=****;pwd
'-----------jitganguly suggesting---------'
Sqlquery = "Select N.SORDER_ORDERID, S.ORDERID,S.SUPP_SUPPID,S.
'--------------------'
'-----------Ajai suggesting---------'
Rs.open Sqlquery, objConn, 3, 3
'--------------------'
%>
<table border="0">
<tr>
<th height="57" colspan="12">Products Details</th>
</tr>
<tr>
<th>Order ID </th>
<th>Order Date</th>
<th>Supplier ID</th>
<th>Total</th>
<th>Action</th>
</tr>
<%
while not Rs.eof
%>
<tr>
<td><% response.write(Rs("ORDERID
<td><% response.write(Rs("SORDER_
<td><% response.write(Rs("SUPP_SU
<td><% response.write(Rs("TOTAL")
<td>View Item | Edit | Delete</td>
</tr>
<%
Rs.MoveNext
Wend
Rs.close
objConn.close
set Rs=nothing
Set objConn=nothing
%>
OK try this SQL
Sqlquery = "Select N.SORDER_ORDERID, S.ORDERID,S.SUPP_SUPPID,S. TOTAL,S.SO RDER_DATE from supp_orders S,INVOICES N where S.ORDERID != N.SORDER_ORDERID"
Note teh not equal signed changed from <> to !=
Sqlquery = "Select N.SORDER_ORDERID, S.ORDERID,S.SUPP_SUPPID,S.
Note teh not equal signed changed from <> to !=
Also put a if not eof, complete code
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
set objConn = server.createObject ("ADODB.connection")
Set Rs=Server.CreateObject("AD ODB.Record set")
objConn.Open "dsn=design01;uid=****;pwd =****;"
'-----------jitganguly suggesting---------'
Sqlquery = "Select N.SORDER_ORDERID, S.ORDERID,S.SUPP_SUPPID,S. TOTAL,S.SO RDER_DATE from supp_orders S,INVOICES N where S.ORDERID != N.SORDER_ORDERID"
'--------------------'
'-----------Ajai suggesting---------'
Rs.open Sqlquery, objConn, 3, 3
'--------------------'
if not Rs.eof
%>
<table border="0">
<tr>
<th height="57" colspan="12">Products Details</th>
</tr>
<tr>
<th>Order ID </th>
<th>Order Date</th>
<th>Supplier ID</th>
<th>Total</th>
<th>Action</th>
</tr>
<%
while not Rs.eof
%>
<tr>
<td><% response.write(Rs("ORDERID "))%> </td>
<td><% response.write(Rs("SORDER_ DATE"))%> </td>
<td><% response.write(Rs("SUPP_SU PPID"))%> </td>
<td><% response.write(Rs("TOTAL") )%> </td>
<td>View Item | Edit | Delete</td>
</tr>
<%
Rs.MoveNext
Wend
else
Response.Write "No Data Found !!!"
end if
Rs.close
objConn.close
set Rs=nothing
Set objConn=nothing
%>
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
set objConn = server.createObject ("ADODB.connection")
Set Rs=Server.CreateObject("AD
objConn.Open "dsn=design01;uid=****;pwd
'-----------jitganguly suggesting---------'
Sqlquery = "Select N.SORDER_ORDERID, S.ORDERID,S.SUPP_SUPPID,S.
'--------------------'
'-----------Ajai suggesting---------'
Rs.open Sqlquery, objConn, 3, 3
'--------------------'
if not Rs.eof
%>
<table border="0">
<tr>
<th height="57" colspan="12">Products Details</th>
</tr>
<tr>
<th>Order ID </th>
<th>Order Date</th>
<th>Supplier ID</th>
<th>Total</th>
<th>Action</th>
</tr>
<%
while not Rs.eof
%>
<tr>
<td><% response.write(Rs("ORDERID
<td><% response.write(Rs("SORDER_
<td><% response.write(Rs("SUPP_SU
<td><% response.write(Rs("TOTAL")
<td>View Item | Edit | Delete</td>
</tr>
<%
Rs.MoveNext
Wend
else
Response.Write "No Data Found !!!"
end if
Rs.close
objConn.close
set Rs=nothing
Set objConn=nothing
%>
ASKER
thanks jitganguly, i did excatly what you suggested but still i have the same problem!
modified code:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
set objConn = server.createObject ("ADODB.connection")
Set Rs=Server.CreateObject("AD ODB.Record set")
objConn.Open "dsn=design01;uid=im259113 ;pwd=im259 113zz;"
Sqlquery = "Select N.SORDER_ORDERID, S.ORDERID,S.SUPP_SUPPID,S. TOTAL,S.SO RDER_DATE from supp_orders S,INVOICES N where S.ORDERID != N.SORDER_ORDERID"
Response.Write(Sqlquery)
Rs.open Sqlquery, objConn, 3, 3
%>
<%if not Rs.eof then
%>
<table border="0">
<tr>
<th height="57" colspan="12">Products Details</th>
</tr>
<tr>
<th>Order ID </th>
<th>Order Date</th>
<th>Supplier ID</th>
<th>Total</th>
<th>Action</th>
</tr>
<%
while not Rs.eof
%>
<tr>
<td><% response.write(Rs("ORDERID "))%> </td>
<td><% response.write(Rs("SORDER_ DATE"))%> </td>
<td><% response.write(Rs("SUPP_SU PPID"))%> </td>
<td><% response.write(Rs("TOTAL") )%> </td>
<td>View Item | Edit | Delete</td>
</tr>
<%
Rs.MoveNext
Wend
Rs.close
objConn.close
set Rs=nothing
Set objConn=nothing
else
Response.Write "No Data Found !!!"
end if%>
</table>
modified code:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
set objConn = server.createObject ("ADODB.connection")
Set Rs=Server.CreateObject("AD
objConn.Open "dsn=design01;uid=im259113
Sqlquery = "Select N.SORDER_ORDERID, S.ORDERID,S.SUPP_SUPPID,S.
Response.Write(Sqlquery)
Rs.open Sqlquery, objConn, 3, 3
%>
<%if not Rs.eof then
%>
<table border="0">
<tr>
<th height="57" colspan="12">Products Details</th>
</tr>
<tr>
<th>Order ID </th>
<th>Order Date</th>
<th>Supplier ID</th>
<th>Total</th>
<th>Action</th>
</tr>
<%
while not Rs.eof
%>
<tr>
<td><% response.write(Rs("ORDERID
<td><% response.write(Rs("SORDER_
<td><% response.write(Rs("SUPP_SU
<td><% response.write(Rs("TOTAL")
<td>View Item | Edit | Delete</td>
</tr>
<%
Rs.MoveNext
Wend
Rs.close
objConn.close
set Rs=nothing
Set objConn=nothing
else
Response.Write "No Data Found !!!"
end if%>
</table>
Take off 3,3 from open i.e Rs.open Sqlquery, objConn
Does the SQL runs from SQLPlus ? Try that first, I have a felling SQL is not right
Also in which line your are getting this ? in Open ? or somewhere else ?
You are missing equal to sign here
<% response.write(Rs("ORDERID "))%>
It should be
<% =response.write(Rs("ORDERI D"))%>
change it everywhere
Complete code
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
set objConn = server.createObject ("ADODB.connection")
Set Rs=Server.CreateObject("AD ODB.Record set")
objConn.Open "dsn=design01;uid=im259113 ;pwd=im259 113zz;"
Sqlquery = "Select N.SORDER_ORDERID, S.ORDERID,S.SUPP_SUPPID,S. TOTAL,S.SO RDER_DATE from supp_orders S,INVOICES N where S.ORDERID != N.SORDER_ORDERID"
Response.Write(Sqlquery)
Rs.open Sqlquery, objConn
%>
<%if not Rs.eof then
%>
<table border="0">
<tr>
<th height="57" colspan="12">Products Details</th>
</tr>
<tr>
<th>Order ID </th>
<th>Order Date</th>
<th>Supplier ID</th>
<th>Total</th>
<th>Action</th>
</tr>
<%
while not Rs.eof
%>
<tr>
<td><%= Rs("ORDERID")%> </td>
<td><% =Rs("SORDER_DATE")%> </td>
<td><%=Rs("SUPP_SUPPID")%> </td>
<td><%=Rs("TOTAL")%> </td>
<td>View Item | Edit | Delete</td>
</tr>
<%
Rs.MoveNext
Wend
Rs.close
objConn.close
set Rs=nothing
Set objConn=nothing
else
Response.Write "No Data Found !!!"
end if%>
</table>
<% response.write(Rs("ORDERID
It should be
<% =response.write(Rs("ORDERI
change it everywhere
Complete code
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
set objConn = server.createObject ("ADODB.connection")
Set Rs=Server.CreateObject("AD
objConn.Open "dsn=design01;uid=im259113
Sqlquery = "Select N.SORDER_ORDERID, S.ORDERID,S.SUPP_SUPPID,S.
Response.Write(Sqlquery)
Rs.open Sqlquery, objConn
%>
<%if not Rs.eof then
%>
<table border="0">
<tr>
<th height="57" colspan="12">Products Details</th>
</tr>
<tr>
<th>Order ID </th>
<th>Order Date</th>
<th>Supplier ID</th>
<th>Total</th>
<th>Action</th>
</tr>
<%
while not Rs.eof
%>
<tr>
<td><%= Rs("ORDERID")%> </td>
<td><% =Rs("SORDER_DATE")%> </td>
<td><%=Rs("SUPP_SUPPID")%>
<td><%=Rs("TOTAL")%> </td>
<td>View Item | Edit | Delete</td>
</tr>
<%
Rs.MoveNext
Wend
Rs.close
objConn.close
set Rs=nothing
Set objConn=nothing
else
Response.Write "No Data Found !!!"
end if%>
</table>
ASKER
hi jitganguly, the sql is right because it does display the all the required record it just only when it want to print the date field on to the screen, for example if i don't request the date field(value) it will show 4 records which is correct.
i tried what you suggested but i still have the same error
CODE:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
set objConn = server.createObject ("ADODB.connection")
Set Rs=Server.CreateObject("AD ODB.Record set")
objConn.Open "dsn=design01;uid=im259113 ;pwd=im259 113zz;"
Sqlquery = "Select N.SORDER_ORDERID, S.ORDERID,S.SUPP_SUPPID,S. TOTAL,S.SO RDER_DATE from supp_orders S,INVOICES N where S.ORDERID != N.SORDER_ORDERID order by S.TOTAL"
Rs.open Sqlquery, objConn
%>
<%if not Rs.eof then
%>
<table border="0">
<tr>
<th height="57" colspan="12">Products Details</th>
</tr>
<tr>
<th>Order ID </th>
<th>Order Date</th>
<th>Supplier ID</th>
<th>Total</th>
<th>Action</th>
</tr>
<%
while not Rs.eof
%>
<tr>
<td><%= Rs("ORDERID")%> </td>
<td><% =Rs("SORDER_DATE")%> </td>
<td><%=Rs("SUPP_SUPPID")%> </td>
<td><%=Rs("TOTAL")%> </td>
<td>View Item | Edit | Delete</td>
</tr>
<%
Rs.MoveNext
Wend
Rs.close
objConn.close
set Rs=nothing
Set objConn=nothing
else
Response.Write "No Data Found !!!"
end if%>
</table>
i tried what you suggested but i still have the same error
CODE:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
set objConn = server.createObject ("ADODB.connection")
Set Rs=Server.CreateObject("AD
objConn.Open "dsn=design01;uid=im259113
Sqlquery = "Select N.SORDER_ORDERID, S.ORDERID,S.SUPP_SUPPID,S.
Rs.open Sqlquery, objConn
%>
<%if not Rs.eof then
%>
<table border="0">
<tr>
<th height="57" colspan="12">Products Details</th>
</tr>
<tr>
<th>Order ID </th>
<th>Order Date</th>
<th>Supplier ID</th>
<th>Total</th>
<th>Action</th>
</tr>
<%
while not Rs.eof
%>
<tr>
<td><%= Rs("ORDERID")%> </td>
<td><% =Rs("SORDER_DATE")%> </td>
<td><%=Rs("SUPP_SUPPID")%>
<td><%=Rs("TOTAL")%> </td>
<td>View Item | Edit | Delete</td>
</tr>
<%
Rs.MoveNext
Wend
Rs.close
objConn.close
set Rs=nothing
Set objConn=nothing
else
Response.Write "No Data Found !!!"
end if%>
</table>
Hai,
I feel something is wrong with your connection string...
Just try this and let me know.
"Driver={Microsoft ODBC for Oracle};Server=OracleServe r.world;Ui d=Username ;Pwd=Passw ord;"
Change the server, username, password and check.
Bye
Ajai
I feel something is wrong with your connection string...
Just try this and let me know.
"Driver={Microsoft ODBC for Oracle};Server=OracleServe
Change the server, username, password and check.
Bye
Ajai
Hai,
Also check this article... There are some examples to check the connctivity problem.
http://support.microsoft.com/default.aspx?scid=kb;en-us;Q255084
Bye
Ajai
Also check this article... There are some examples to check the connctivity problem.
http://support.microsoft.com/default.aspx?scid=kb;en-us;Q255084
Bye
Ajai
ASKER
thanks all i figure out why i was getting that error, and as you jitganguly the problem was with SQL command, apparently Oracle must first convert that value from the special internal format to a printable string. so i used TO_CHAR command and it did worked!!
my sql now looks like this:
Sqlquery = "Select N.SORDER_ORDERID, S.ORDERID,S.SUPP_SUPPID,S. TOTAL,to_c har(S.SORD ER_DATE, 'DD MM YY') as d from supp_orders S,INVOICES N where S.ORDERID != N.SORDER_ORDERID order by S.TOTAL"
thank you all again.
my sql now looks like this:
Sqlquery = "Select N.SORDER_ORDERID, S.ORDERID,S.SUPP_SUPPID,S.
thank you all again.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Try this.
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
set objConn = server.createObject ("ADODB.connection")
Set Rs=Server.CreateObject("AD
objConn.Open "dsn=design01;uid=****;pwd
Sqlquery = "Select ORDERID,SUPP_SUPPID,TOTAL,
'Response.Write(Sqlquery)
Rs.open Sqlquery, objConn, 3, 3
%>
<HTML>
<table border="0">
<tr>
<th height="57" colspan="12">Orders </th>
</tr>
<tr>
<th>Order ID </th>
<th>Order Date</th>
<th>Supplier ID</th>
<th>Total</th>
<th>Action</th>
</tr>
<%
If not Rs.EOF Then
while not Rs.eof
%>
<tr>
<td><%=Rs("ORDERID") & ""%></td>
<td><%=Rs("SORDER_DATE") & ""%></td>
<td><%=Rs("SUPP_SUPPID") & ""%></td>
<td><%=Rs("TOTAL") & ""%></td>
<td>View Item | Edit | Delete</td>
</tr>
<%
Rs.MoveNext
Wend
End If
Rs.close
objConn.close
set Rs=nothing
Set objConn=nothing
%>
</table>
</HTML>
Bye
Ajai