Ask a Question related to ASP Database, Design and Development.
-
Jeremy #1
Calling from db gives unwanted 'null' response
Hello,
I'm trying to get a code to work wherein I'd like to display
information, some of which may or may not be blank from a database
onto a webpage. Currently, the output is as in the following example:
John Smith
null
123 Main St
I'd like the null to be ignored. Any ideas??
Here is my code:
<%
var tbl="";
var rs = Server.CreateObject("ADODB.Recordset");
var sql = "SELECT DISTINCT Photos.Photo, Photos.Artist,
Artists.Organization, Artists.Address1 FROM Photos, Artists WHERE
Photos.Artist = Artists.Artist";
rs.Open(sql,strconnection);
var n=0;
while (!rs.EOF)
{
var img = rs.Fields("Photo");
var art = rs.Fields("Artist");
var org = rs.Fields("Organization");
var ad1 = rs.Fields("Address1");
{
var tbl = tbl += "<table border='0'>\n";
{
tbl += " <td>\n";
tbl += " <IMG src='images/" + img + "'>\n";
tbl += " </td>\n";
tbl += " <td>Artist:" + art + " \n";
tbl += " <br>" + org + "\n";
tbl += " <br> " + ad1 + "\n";
}
tbl += "</table>\n";
}
rs.MoveNext();
n++;
}
rs.Close();
Response.Write("document.repForm.write('" + tbl + "')")
%>
</script>
</head>
<html>
<BODY>
<%=tbl%>
</BODY>
</HTML>
Jeremy Guest
-
Calling a fuction from a response Handler
I use a function with remote call to populate a grid with data and it works fine. function getStudentAll() { <cfoutput> var... -
null object returnd to .net client while calling axis web service
Hi , I have a java web services (message style web service whichreturns document object) on axis and im trying to access it fromvb.net client. It is... -
Slow login response response on TS 03 in AD mixed mode
We upgraded our NT 4 domain to an AD mixed until we get rid of the NT 4 BDC;s after completing this upgrade users began complaining about how long... -
Newbie: null response when switching from framework 1.0 to 1.1
Hi, in the past days I've been fighting with a strange situation. We have to build an application able to get some information from a soap server.... -
AW7 vs. DirectorMX for psychology experiment using response times AND response answers
Hello, I'm very new to application design, but need to develop a web based application to use at multiple schools as part of an experimental... -
Bullschmidt #2
Re: Calling from db gives unwanted 'null' response
Perhaps change this:
tbl += " <br>" + org + "\n";
To be more like this:
If Not IsNull(Org) Then
tbl = tbl & " <br>" & org & "\n";
End If
Best regards,
J. Paul Schmidt, Freelance ASP Web Developer
[url]http://www.Bullschmidt.com[/url]
ASP Design Tips, ASP Web Database Demo, Free ASP Bar Chart Tool...
*** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
Don't just participate in USENET...get rewarded for it!
Bullschmidt Guest
-
Jeremy #3
Re: Calling from db gives unwanted 'null' response
Thanks for your response, although if I do that, I get the following error:
Error Type:
Microsoft JScript compilation (0x800A03EC)
Expected ';'
/iti/fpdb/Forms/photogallery.asp, line 41, column 3
If Not IsNull(Org) Then
--^
Bullschmidt <paul@bullschmidt.com-nospam> wrote in message news:<e3BjbGg9DHA.2524@TK2MSFTNGP11.phx.gbl>...> Perhaps change this:
> tbl += " <br>" + org + "\n";
>
> To be more like this:
> If Not IsNull(Org) Then
> tbl = tbl & " <br>" & org & "\n";
> End If
>
> Best regards,
> J. Paul Schmidt, Freelance ASP Web Developer
> [url]http://www.Bullschmidt.com[/url]
> ASP Design Tips, ASP Web Database Demo, Free ASP Bar Chart Tool...
>
>
> *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
> Don't just participate in USENET...get rewarded for it!Jeremy Guest
-
Bob Barrows [MVP] #4
Re: Calling from db gives unwanted 'null' response
Jeremy wrote:
That's vbscript, not jscript. Here's the jscript version:> Thanks for your response, although if I do that, I get the following
> error:
>
> Error Type:
> Microsoft JScript compilation (0x800A03EC)
> Expected ';'
> /iti/fpdb/Forms/photogallery.asp, line 41, column 3
> If Not IsNull(Org) Then
> --^
if (Org != null) {
HTH,
Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Bob Barrows [MVP] Guest
-
The Mighty Chaffinch #5
Re: Calling from db gives unwanted 'null' response
> Perhaps change this:
In JScript syntax:> tbl += " <br>" + org + "\n";
>
> To be more like this:
> If Not IsNull(Org) Then
> tbl = tbl & " <br>" & org & "\n";
> End If
tbl += (org) ? " <br>" + org + "\n" : "";
MC
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system ([url]http://www.grisoft.com[/url]).
Version: 6.0.577 / Virus Database: 366 - Release Date: 04/02/04
The Mighty Chaffinch Guest
-
Jeremy #6
Re: Calling from db gives unwanted 'null' response
I appreciate all of your responses, but none of these solutions seem
to work. They don't give an error, but they don't remove the 'null'
either....
Jeremy Guest
-
The Mighty Chaffinch #7
Re: Calling from db gives unwanted 'null' response
> I appreciate all of your responses, but none of these solutions seem
If you post the ASP/JScript code after the changes, also the HTML that this> to work. They don't give an error, but they don't remove the 'null'
> either....
produced (use View/Source in yr browser) then I'm sure someone here can
figure it out.
I noticed a couple of other things:
1) I'm unsure about the effect of using the \n char in server-side JScript,
I always use <BR> myself.
2) Where you use code like:
var art = rs.Fields("Artist");
I always use:
var art = rs.Fields("Artist").Value;
It could be that the 2nd point is causing yr problem: you may be getting the
string "null" from the field instead of the value null.
HTH
MC
The Mighty Chaffinch Guest
-
Jeremy #8
Re: Calling from db gives unwanted 'null' response
That did it! Thanks... it was the .values that was holding the whole
thing up... It's always something little isn't it?
Thanks for all the help!
Jeremy
"The Mighty Chaffinch" <MightyChaffinch@hotmail.com> wrote in message news:<OwT50Zx9DHA.2644@TK2MSFTNGP11.phx.gbl>...>> > I appreciate all of your responses, but none of these solutions seem
> > to work. They don't give an error, but they don't remove the 'null'
> > either....
> If you post the ASP/JScript code after the changes, also the HTML that this
> produced (use View/Source in yr browser) then I'm sure someone here can
> figure it out.
>
> I noticed a couple of other things:
> 1) I'm unsure about the effect of using the \n char in server-side JScript,
> I always use <BR> myself.
> 2) Where you use code like:
> var art = rs.Fields("Artist");
> I always use:
> var art = rs.Fields("Artist").Value;
>
> It could be that the 2nd point is causing yr problem: you may be getting the
> string "null" from the field instead of the value null.
>
> HTH
>
> MCJeremy Guest



Reply With Quote

