close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Insert Null if parameter does not exist

Thread began 9/01/2009 7:57 am by xag | Last modified 9/01/2009 2:21 pm by Jason Byrnes | 3743 views | 7 replies |

xag

Insert Null if parameter does not exist

Hello quick question. I have a page that takes a parm from a link and inserts the parm into a SQL database before the page loads. the problem is that if the Parm does not exisit I get an error

Microsoft VBScript runtime  error '800a0009'

Subscript out of range: 'i'

/../WA_DataAssist/WA_AppBuilder_VB.asp, line 238



The page is here

BVDM.asp

I want this URL to work with or without the ".asp?myparm=" in there and just insert NULL into the database... anyone know how to accomplish this?


thanks
-X

Sign in to reply to this post

Jason ByrnesWebAssist

You could create an application variable and set it to Blank if the Querystring is not set:
<%
dim myparam
If Request.QueryString("myparam") = "" Then
myparam = " "
Else
myparam = Request.QueryString("myparam")
End If
%>


and use the application variable in the database insert instead of the query string variable.

Sign in to reply to this post

xag

Hey thanks for the response. Jason... just one last question.. in the Insert Record wizard i would type in

<% Response.write(myparm) %>



but it is still not working.. i see that when I just type the code into the page I see the parm and Null when there is no parm but when I put that into the wizard I still get the same error


any ideas?

Sign in to reply to this post

Jason ByrnesWebAssist

Sounds like it wont take a blank string.

try using:
<%
dim myparam
If Request.QueryString("myparam") = "" Then
myparam = "N/A"
Else
myparam = Request.QueryString("myparam")
End If
%>



this will insert "N/A" in the database if the string does not exist.

Sign in to reply to this post

xag

Yup I got that part working.. and I did see it on the page when I did a quick test with the ASP

<% Response.Write(myparm) %>



The problem comes here where the WA application is iserted

WA_fieldValuesStr = "" & cStr(cStr(Response.Write(myparm))) & ""



I think i am just typing it wrong or something in there....

Sign in to reply to this post

Jason ByrnesWebAssist

I think this should just be:

php:
WA_fieldValuesStr = "" & cStr(cStr(myparm)) & ""
Sign in to reply to this post

xag

Correct!

Thanks Jason

Sign in to reply to this post

Jason ByrnesWebAssist

You're welcome.

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...