Howdy,
I am trying to accomplish the following:
dim DateSend as date
if txtDateSend.tex t = "" then
DateSend = dbnull.value
else
DateSend = txtDateSend.tex t
end if
however, the script screams about "Value of type 'System.DBNull' cannot be
converted to 'Date'." How do I send a Null back? This variable, DateSend, is
then sent to a stored procedure and written back to the database. I read
other posts on google groups stating users switched the variables from date
to string, then did a cast within the proc. Is this really the best
solution? Come on, Microsoft must have a way of loading an empty value into
a date object.
thanks!!
David Lozzi 1 2943
DateTime is a value type (Date maps to DateTime with no time set), so it
cannot be set to null or dbnull (only reference types can be set to null
reference and even them cannot be set to dbnull.value, except object type
itself).
You can have DateTime.MinVal ue to indicate that the value has not been set
or is empty, and before setting the value to the parameter, check the
DateTime being MinValue and based on that pass DBNull straight to the proc
(or use default values in procs so you'd need to apss only parameters having
a value).
--
Teemu Keiski
ASP.NET MVP, Finland
"David Lozzi" <dlozzi@(remove )delphi-ts.com> wrote in message
news:en******** ******@TK2MSFTN GP09.phx.gbl... Howdy,
I am trying to accomplish the following:
dim DateSend as date
if txtDateSend.tex t = "" then DateSend = dbnull.value else DateSend = txtDateSend.tex t end if
however, the script screams about "Value of type 'System.DBNull' cannot be converted to 'Date'." How do I send a Null back? This variable, DateSend, is then sent to a stored procedure and written back to the database. I read other posts on google groups stating users switched the variables from date to string, then did a cast within the proc. Is this really the best solution? Come on, Microsoft must have a way of loading an empty value into a date object.
thanks!!
David Lozzi
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: christopher.secord |
last post by:
I would like have a little "loading..." tab not unlike the one that
gmail uses and I would like to display that tab while an ajax call is
made. The javascript to display the tab works. The javascript to hide
the tab works. But when I put the two together inside the function
that calls the ajax service, they don't work.
What seems to happen is that calls to change DOM object properties are
queued up, and then all executed...
|
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 is not much help here either.
Googling has given me a little help.
This is my current understanding -- I would appreciate any comments or
corrections...
"" -- this means an empty string when applied to String data type, and also
to Variant...
|
by: Matthew Wieder |
last post by:
Hi - I have a datagrid that has a black header and the rows alternate
white and gray. The problem is that until items are added to the grid,
the grid appears as a large black rectangle, which is quite ugly. The
black area is larger then it is once an item is added. How can I solve
this problem either by:
A) Having only the header black and the rest of the empty block white or
gray (preffered solution)
B) Having the color gray or white...
|
by: Reza |
last post by:
Hi
I have a column in my datagrid that can have values of null at times. I am not assigning any value to it, if it is coming from Database empty. Now, the problem is I guess the datetime variables have a default value. Thus shows an undesirable value of 1/1/0001
How do I go about not showing anything when the value is null like this
Thanks in advance
Reza
|
by: Eric Maia |
last post by:
I have a textbox (StartDateTextBox) in a UserControl on my page, that
is supposed to have a date entered into it. I have a
RequiredFieldValidator that has its ControlToValidate property set to
the textbox. I also have a CompareValidator pointed to the textbox
with its Type="Date."
Despite all documentation to the contrary, I am getting an exception
when the page first loads that is thrown by the CompareValidator,
complaining that it...
| |
by: Rob |
last post by:
I was working on a project and everything was going fine,
then all of a sudden the form set as my startup object
stopped loading. I tried setting some others as the
startup object, and some of my forms will load and others
won't. Those that won't load at startup don't load with
the Show or ShowDialog command either. Can anyone give
me a hint as to what went wrong?
|
by: Dabbler |
last post by:
I'm using an ObjectDataSource with a stored procedure and am getting the
following error when trying to update (ExecuteNonQuery):
System.Data.SqlClient.SqlException: Procedure or Function 'UpdateRegistrant'
expects parameter '@EMail', which was not supplied.
The field value was null in the database and not changed in the FormView so
is null going back into the stored procedure. I'm stumped and would greatly
appreciate any suggestions.
|
by: Nickolai Leschov |
last post by:
Hello all,
I am programming an embedded controller that has a 'C' library for using
its system functions (I/O, timers, all the specific devices). The
supplied library has .LIB and .H files.
How can I dynamically load a LIB file and access all its functions?
Surely someone has solved similar task?
My intention is to use a Forth system for programming the controller,
|
by: Jeff |
last post by:
Hi
I'm trying to achieve a scenario where I have c# files that are compiled
dynamically, the assemblies are then loaded in a different AppDomain, I call
a simple method from the object, and then unload the AppDomain to release
the lock on the assemly files (so to I can compile the code again if it has
been modified). However, I've encountered a problem, whereby the assembly is
also loaded in the default AppDomain!
I have a few classes...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |