473,326 Members | 2,133 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Invalid use of null

229 100+
Hi, I have looked around and this seems to be a common problem when a database field is empty. I have this and none of the solutions I have seen seem to work. I tried ),"'","<") but that didnt solve anything.


Expand|Select|Wrap|Line Numbers
  1. Response.Write "<tr><td height=""30"" width=""300"" align=""left"" valign=""middle""><font size=""2"">site</font></td>"
  2. Response.Write "<td height=""30"" width=""250"" align=""left"" valign=""middle""><input type=""text"" name=""imageone"" value=""" & Replace(objOptionsAndInfo("imageone"), Chr(34), "&quot;") & """ size=""30"" maxlength=""45""></td></tr>"
If anyone has a solution that would be great.
Thanks
Richard
Jun 11 '09 #1
6 3835
prabirchoudhury
162 100+
1. Response.Write("html hoes here"); would be like that


Expand|Select|Wrap|Line Numbers
  1.            Response.Write("<table width=500>");
  2.             Response.Write("<tr>");
  3.             Response.Write("<td align=right>");
  4.             Response.Write("<BR>");
  5.             Response.Write(DateTime.Now.ToString());
  6.             Response.Write("</td>");
  7.             Response.Write("</tr>");
  8.             Response.Write("</table>"); 
  9.  
have a look on

Carriage Return and Response.Write Output Issue

:)
Jun 12 '09 #2
GazMathias
228 Expert 128KB
Personally, I can't stand response.writing out html. If I have to mix content with code I always come out of vbscript and just type out the html:

Expand|Select|Wrap|Line Numbers
  1. <table>
  2.   <tr>
  3.     <th>Field One</th>
  4.     <th>Field Two</th>
  5.     <th>Field Three</th>
  6.   </tr>
  7.  
  8. <% Do While Not blah.... %>
  9.   <tr>
  10.     <td><%=rs("fieldone")%></td>
  11.     <td><%=rs("fieldtwo")%></td>
  12.     <td><%=rs("fieldtwo")%></td>
  13.   </tr>
  14. <% rs.movenext
  15. Loop %>
  16. </table>
  17.  
If you use a decent editor that highlights code well (I recommend Notepad++), there are obvious benefits.

As to your original question, check if the field isn't empty before you use replace:

Expand|Select|Wrap|Line Numbers
  1. <% If not objOptionsAndInfo("imageone") = "" then Replace(objOptionsAndInfo("imageone"), Chr(34), "&quot;") %> 
Gaz
Jun 12 '09 #3
fran7
229 100+
Thanks to you guys I have sorted it now.
Thanks
Richard
Jun 14 '09 #4
jhardman
3,406 Expert 2GB
@GazMathias
I agree strongly.

Jared
Jun 15 '09 #5
Nicodemas
164 Expert 100+
@GazMathias
I'm not so sure on this one, personally. It's been tested that (extensive) intermingling of dynamic and non-dynamic script causes CPU overhead to increase.


Form a clean code point of view, I just use line continuations when appropriate:

Expand|Select|Wrap|Line Numbers
  1. response.write "I've got a lovely bunch " & _
  2.                       "of coconuts! Deedly, dee! " & _
  3.                       "There they are standing in a row." & _
  4.                       "<big>Big ones!</big>" & _
  5.                       "<small>Small ones!</small>"
  6.  
  7.  
Clean.
Jun 17 '09 #6
jhardman
3,406 Expert 2GB
@Nicodemas
line continuations, fine, I don't have a problem with that. I have just seen too many people trying to response.write complex HTML including escaped quote marks. They always lose count of their quotes and can't decipher the error messages.
Expand|Select|Wrap|Line Numbers
  1. response.write "<input type=""text"" value="" &      rs("myTextValue") & "" name=""myTextValue"">" & vbNewLine
Do you see where the error is? the error would be something like "Command expected".

Or they use non-strict or even non-standard HTML because they are trying to avoid using quotes. The only other solution I've liked, is to assign double quotes to a variable
Expand|Select|Wrap|Line Numbers
  1. dim q
  2. q = chr(34)
  3. response.write "<input type=" & q & "text" & q & " value=" & q & _
  4.       rs("myTextValue") & q & " name=" & q & "myTextValue" & q & ">" &_
  5.       vbNewLine
but this is much less-clean than this
Expand|Select|Wrap|Line Numbers
  1. %>
  2. <input type="text" name="myTextValue" value="<%=rs("myTextValue")%>">
  3. <%
I don't know which executes faster, but I know this last is easier to read, write and troubleshoot.

Jared
Jun 17 '09 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Thomas Barth | last post by:
Hi, I'm new to windows programming and still reading a book about windows-programming with C++. I copied the following code from the book into my ide (Eclipse/CDT) to comprehend the code, but two...
1
by: Patrick Dunnigan | last post by:
Hi, I am attempting a bulk copy from a c program into SQL Server 2000 using DBLib in freeTDS 0.63 RC11 (gcc 3.4.3, RH 9). I am getting an error message that I cannot find any documentation on. ...
2
by: headware | last post by:
I'm getting a weird problem in an Access query. I have a table that contains a field calle F1 that's a 2 character text field. The first character is always a number. What I'd like to do is find...
3
by: Frank Perry | last post by:
Howdy, I'm trying to write data out the com port. I have taken the code from the sample on the MSDN Library CD and used the parts that seem relevant. I can open the com port with CreateFile...
0
by: Jerry | last post by:
Below is ALL the code for all the databases... Here's the problem: I callup the aspx file in IE and the form comes up just fine. When I select a person to update, I get the subject error. ...
15
by: David | last post by:
Hi, I have built a web application that will be a very high profile application. We had tested it, demonstrated it and shown that it all works. On a dress rehearsal run through, it failed...
9
by: Jamie | last post by:
I am receiving an Invalid ViewState error after posting back to the same page twice. Consistently the error occurs after the second postback and not after the first. I have looked into creating...
6
by: KWienhold | last post by:
I'm currently working on a project in C# (VS 2003 SP1, .Net 1.1) that utilizes IStream/IStorage COM-Elements. Up to now I have gotten everything to work to my satisfaction, but now I have come...
0
by: shrik | last post by:
I have following error : Total giant files in replay configuration file are : File name : /new_file/prob1.rec Given file /new_file/prob1.rec is successfully verified. Splitting for giant file...
3
by: rando1000 | last post by:
I'm pulling data from a field on a form, evaluating whether or not it's null, then calculating based on the data in the field. Here's my code for evaluating the field: intAdvanced = IIf(Not...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.