Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Empty string to DBNull in Classic ASP

Posted on 2010-09-23
3
Medium Priority
?
2,981 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

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

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

This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

597 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