473,473 Members | 1,492 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

format empty as null prior to insert

Hey folks,

This one's probably been asked before but I'm tired of trying to find a
solution (if there is one!). I have an asp update page and I'd like to
convert all empty fields to NULL prior to updating the Access db rather than
permitting zero length fields in the db. Is this possible? Is there any way
to globally declare this for all text fields on the asp page rather than
having to do a whole whack of "if then" formats? Is there something I can
set in the field's properties in Access that will deny zero length yet won't
cause the asp update to choke and return an error?

Thanks for any feedback,

Dave

--
______________________________
Remove "_SPAM" to reply directly.
Jul 22 '05 #1
6 1489
David Shorthouse wrote:
Hey folks,

This one's probably been asked before but I'm tired of trying to
find a solution (if there is one!). I have an asp update page and I'd
like to convert all empty fields to NULL prior to updating the Access
db rather than permitting zero length fields in the db. Is this
possible?
Sure, just pass Null when the user does not enter data.
Is there any way to globally declare this for all text
fields on the asp page rather than having to do a whole whack of "if
then" formats?
No
Is there something I can set in the field's properties
in Access that will deny zero length yet won't cause the asp update
to choke and return an error?


No.

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jul 22 '05 #2
Bob,

Thanks for the quick response. How then does one pass null when the
field is empty? I'm sad to hear there isn't any way to declare this for all
variables in one shot, say at the very beginning of the script on the the
asp. Could you provide a vbscipt I ought to include on the asp?

Thanks.

Dave

--
______________________________
Remove "_SPAM" to reply directly.
"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
David Shorthouse wrote:
Hey folks,

This one's probably been asked before but I'm tired of trying to
find a solution (if there is one!). I have an asp update page and I'd
like to convert all empty fields to NULL prior to updating the Access
db rather than permitting zero length fields in the db. Is this
possible?


Sure, just pass Null when the user does not enter data.
Is there any way to globally declare this for all text
fields on the asp page rather than having to do a whole whack of "if
then" formats?


No
Is there something I can set in the field's properties
in Access that will deny zero length yet won't cause the asp update
to choke and return an error?


No.

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"

Jul 22 '05 #3
David Shorthouse wrote:
Bob,

Thanks for the quick response. How then does one pass null when the
field is empty? I'm sad to hear there isn't any way to declare this
for all variables in one shot, say at the very beginning of the
script on the the asp. Could you provide a vbscipt I ought to include
on the asp?


It depends. Are you using a recordset (not recommended)? Dynamic SQL (also
not recommended)? Parameters?
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jul 22 '05 #4
Bob,

I am indeed using a recordset with UPDATE and SET. Why is this not
recommended? What's the better alternative?

Dave

--
______________________________
Remove "_SPAM" to reply directly.
"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> wrote in message
news:e5**************@TK2MSFTNGP09.phx.gbl...
David Shorthouse wrote:
Bob,

Thanks for the quick response. How then does one pass null when the
field is empty? I'm sad to hear there isn't any way to declare this
for all variables in one shot, say at the very beginning of the
script on the the asp. Could you provide a vbscipt I ought to include
on the asp?


It depends. Are you using a recordset (not recommended)? Dynamic SQL (also
not recommended)? Parameters?
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"

Jul 22 '05 #5
David Shorthouse wrote:
Bob,

I am indeed using a recordset with UPDATE and SET. Why is this not
recommended? What's the better alternative?


This is a contradiction. Using a recordset, you would open a recordset on a
table or select statement, point the cursor at a record, set the field
values and use the Update method to send the changes to the database. This
is not recommended because cursors are resource-intensive and slow. In ASP,
they should only be used to retrieve read-only data for display purposes.

Using "UPDATE and SET" seems to imply that you are using dynamic sql. This
is not recommended due to the security concerns brought on by leaving
yourself open to sql injection attacks by hackers:
http://mvp.unixwiz.net/techtips/sql-injection.html
http://www.sqlsecurity.com/DesktopDefault.aspx?tabid=23
http://www.nextgenss.com/papers/adva..._injection.pdf
http://www.nextgenss.com/papers/more..._injection.pdf
Perhaps you should read these:

http://www.google.com/groups?hl=en&l...TNGP12.phx.gbl

http://groups-beta.google.com/group/...e36562fee7804e
Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jul 22 '05 #6
"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> wrote in message
news:OZ**************@TK2MSFTNGP15.phx.gbl...
: David Shorthouse wrote:
: > Bob,
: >
: > I am indeed using a recordset with UPDATE and SET. Why is this not
: > recommended? What's the better alternative?
<snip>
: Using "UPDATE and SET" seems to imply that you are using dynamic sql. This
: is not recommended due to the security concerns brought on by leaving
: yourself open to sql injection attacks by hackers:

I'd be happy to test those for ya', David. (O:=

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp
Jul 22 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Chris | last post by:
I have tableA, defined as: field1 varchar2(10), field2 varchar2(10), field3 varchar2(10) I have host variables defined as: v1 pic x(10) varying v2 pic x(10) varying
2
by: FizzBin | last post by:
We are writing a C application that is using ODBC to insert records into a database. We have a NOT NULL column that can legitimately have an empty value, i.e. we know the value and it is empty...
2
by: Bernd Lambertz | last post by:
I have a problem with bcp and format files. We changed our databases from varchar to nvarchar to support unicode. No problems so fare with that. It is working fine. But now I need a format...
2
by: ezelasky | last post by:
We are using the bcp utility (via APIs) to export data from a SQL table in a fixed format text file. BCP is inserting spaces for a field if the field contains a NULL. This is fine with us except...
8
by: Lyn | last post by:
I am trying to get my head around the concept of default, special or empty values that appear in Access VBA, depending on data type. The Access Help is not much (help), and the manual that I have...
5
by: ramonred | last post by:
Hi All, this is the error: Input string was not in a correct format. this is the code I am trying to debug: <code> string sql = @" INSERT INTO (UserID, Login, Password, FirstName, LastName,...
2
by: surya | last post by:
hello all i want to create a phone table and it contains two fields empid ,ph. the phone table following format: Phone table ------------------------------------------ empid ph...
2
by: Mike | last post by:
Greetings, It would seem that this topic has been discussed at some length, but I was unable to discern whether there was a clear cut solution to resolve and/or otherwise workaround the issue. ...
12
by: robertino | last post by:
Hi all, I've put together a few SPs to produce a BOM (bill of materials) listing, which together use a couple of global temp tables, and return the results from a cursor. Here's the code: ...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.