?
Solved

Empty string to DBNull in Classic ASP

Posted on 2010-09-23
3
Medium Priority
?
2,943 Views
Last Modified: 2012-05-10
I'm using classic ASP/VBScript and a SQL Server 2008 database.  I have  a text field that is optional. If a user leaves this field blank I want to sumbit a DBNull to my database.  How do I do this?

See attached Classic ASP/VBScrip code.




strEventAcronym = TRIM ( Request.Form( "eventAcronym" ) )

If strEventAcronym = "" Then
       strEventAcronym = ??? DBNULL ???
End If

' Perform INSERT

Open in new window

0
Comment
Question by:cdemott33
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 7

Expert Comment

by:waltersnowslinarnold
ID: 33746323
Dont pass any value from the front end, it automatically considers as NULL.
0
 

Author Comment

by:cdemott33
ID: 33746988
So how would I perform the Insert if there is not value?
0
 
LVL 3

Accepted Solution

by:
LouSch7 earned 2000 total points
ID: 33747900
Here's the way I would do it.
strEventAcronym = TRIM ( Request.Form( "eventAcronym" ) )

If strEventAcronym = "" Then strEventAcronym = "NULL" End If

' Perform INSERT

Open in new window

0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Welcome, welcome!  If you are new to the series and haven't been following along, please take a brief moment to review the first three installments: Part 1 (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/A_266-VBScri…
I met Paul Devereux (@pdevereux) today when I responded to his tweet asking “Anybody know how to automate adding files from disk to a folder in #outlook  ?”.  I replied back and told Paul that using automation, in this case scripting, to add files t…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question