|
 |
asp_databases thread: MS SQL display strangeness
Message #1 by mpelley@c... on Mon, 18 Nov 2002 14:04:41
|
|
Hi, I'm having an extremely strange thing happening to my asp scripts.
They are suppose to display data from an ms sql database. Basically I
wrote the scripts initally for an acess database and they worked fine, the
asp page takes data from two tables and displays them on a page. When I
moved the pages over to our new web server (w2k IIS 5.0 and MS SQL 2000).
I reset the connections, and they work fine, but when I go to display the
data on my asp page only data from one of the tables will display, the
district field My date field says Dec 30 1899, and the memo field is
blank. Basically its only four peices of info a district name, memo name,
a file path and a date field. The District name is in a simple table on
its own, and the memo, path and date are in another. The strange thing is
if I do a simple test outside of my loop that is inserting the data into
my html table to see if it's getting the first row (which it is getting)
it then instead of showing the district shows the memo and date for the
first row in the table and then jumps back to just displaying the district
name, and Dec 30, 1899 as the date for all subsequent rows. I'm stumpped!
If anyone can help me out here I would really appreaciate it. Mark
Here is the code that I am using to pull and display the data.
set rsmemo=Server.CreateObject("ADODB.RecordSet")
strSQL= "Select tbl_DHA.strdha, tbl_memo.strMemo, tbl_memo.strDate,
tbl_memo.strpath " &_
"From tbl_DHA INNER JOIN tbl_memo " &_
"ON tbl_DHA.intDhaKey= tbl_memo.intDhaKey "&_
"WHERE (tbl_memo.IntDhaKey ="&dha&" )"
set rsmemo=contoDB.Execute(strSql)
%>
'(This is the test to see if the info was actually coming out)
<%
Response.Write(rsmemo("strDHA"))
Response.Write(rsMemo("strMemo"))
Response.Write(rsMemo("strDate"))%>
<TABLE width="552" BORDER=1>
<TD width="181" bgcolor="#0099ff"><b><u>District Health
Authority</u></b></TD>
<TD width="166" bgcolor="#0099ff">
<div align="center"><b><u> Name
of Memo </u></b></div></TD>
<TD width="157" bgcolor="#0099ff"><b><u>
<center>Date Added </center></u></b></TD>
</TR>
<TR>
<TH COLSPAN=3> </TH>
</TR>
<font class="normal"></font>
<% Do While Not rsMemo.EOF %>
<TR>
<TD><center><B><% Response.Write(rsMemo("strDha"))%>
</B></Center></TD>
<TD><center><B><a href="<% =(rsMemo("strPath"))%>">
<% Response.Write(rsMemo("strMemo")) %>
</B></Center></a></TD>
<TD><B><center><% Response.write FormatDateTime((rsmemo("strDate")),1)%>
</B></Center></TD>
<%
rsMemo.MoveNext
Loop
%>
</table>
<%
rsMemo.Close
set rsMemo=Nothing
%>
Message #2 by "Imar Spaanjaars" <Imar@S...> on Tue, 19 Nov 2002 17:53:00
|
|
There are some known issues with displaying BLOB data (Memo fields) in
ADO.
What version of ADO are you using?
Usually you can work around the problem by querying and using the Memo
field last, like this:
SELECT aDate, aText, aMemo FROM MyTable
Response.Write(aDate)
Response.Write(aText)
Response.Write(aMemo)
If you need the memo field first, assign the other fields to variables
first and then use that.
Also, don't try to read the Memo field more than once.
HtH
Imar
> Hi, I'm having an extremely strange thing happening to my asp scripts.
T> hey are suppose to display data from an ms sql database. Basically I
w> rote the scripts initally for an acess database and they worked fine,
the
a> sp page takes data from two tables and displays them on a page. When I
m> oved the pages over to our new web server (w2k IIS 5.0 and MS SQL
2000).
I> reset the connections, and they work fine, but when I go to display
the
d> ata on my asp page only data from one of the tables will display, the
d> istrict field My date field says Dec 30 1899, and the memo field is
b> lank. Basically its only four peices of info a district name, memo
name,
a> file path and a date field. The District name is in a simple table on
i> ts own, and the memo, path and date are in another. The strange thing
is
i> f I do a simple test outside of my loop that is inserting the data
into
m> y html table to see if it's getting the first row (which it is
getting)
i> t then instead of showing the district shows the memo and date for the
f> irst row in the table and then jumps back to just displaying the
district
n> ame, and Dec 30, 1899 as the date for all subsequent rows. I'm
stumpped!
I> f anyone can help me out here I would really appreaciate it. Mark
> Here is the code that I am using to pull and display the data.
> set rsmemo=Server.CreateObject("ADODB.RecordSet")
> strSQL= "Select tbl_DHA.strdha, tbl_memo.strMemo, tbl_memo.strDate,
t> bl_memo.strpath " &_
"> From tbl_DHA INNER JOIN tbl_memo " &_
"> ON tbl_DHA.intDhaKey= tbl_memo.intDhaKey "&_
"> WHERE (tbl_memo.IntDhaKey ="&dha&" )"
s> et rsmemo=contoDB.Execute(strSql)
%> >
'> (This is the test to see if the info was actually coming out)
<> %
R> esponse.Write(rsmemo("strDHA"))
R> esponse.Write(rsMemo("strMemo"))
R> esponse.Write(rsMemo("strDate"))%>
> <TABLE width="552" BORDER=1>
> <TD width="181" bgcolor="#0099ff"><b><u>District Health
> Authority</u></b></TD>
> <TD width="166" bgcolor="#0099ff">
> <div align="center"><b><u> Name
> of Memo </u></b></div></TD>
> <TD width="157" bgcolor="#0099ff"><b><u>
> <center>Date Added </center></u></b></TD>
> </TR>
> <TR>
> <TH COLSPAN=3> </TH>
> </TR>
> <font class="normal"></font>
> <% Do While Not rsMemo.EOF %>
> <TR>
> <TD><center><B><% Response.Write(rsMemo("strDha"))%>
> </B></Center></TD>
> <TD><center><B><a href="<% =(rsMemo("strPath"))%>">
> <% Response.Write(rsMemo("strMemo")) %>
> </B></Center></a></TD>
> <TD><B><center><% Response.write FormatDateTime((rsmemo("strDate")),1)%
>
> </B></Center></TD>
> <%
> rsMemo.MoveNext
> Loop
> %>
<> /table>
> <%
> rsMemo.Close
> set rsMemo=Nothing
%> >
|
|
 |