I have a simple form that has a bunch of textboxes that show data from
a dataset table.
When I "Add" a record with BindingManagerBase.AddNew(), all the
textboxes go blank, so I can add a new record.
If I leave a field totally blank, and then click the Update button
(which uses the DataAdapter.Update() command, I get an error saying:
"Field 'Orders.Email' cannot be a zero-length string"
Does .NET not allow zero-length strings?
I tried programmatically adding a space (" ") to the textbox like this:
If tbEmail.Text = "" Then
tbEmail.Text = " "
'also tried tbEmail.text = chr(32)
'also tried tbEmail.text = vbnull
End If
But after I get the error, this textbox still has no space in it.
I'm stumped. Can someone help?
Thanks!
John 2 5890
Hi John,
It's .net that's disallowing the add - it's your database. What is the
backend? What are the characteristics of the email column? Are you
updating using the commandbuilder or using manual update commands?
HTH,
Bernie Yaeger
"johnb41" <or****@informatik.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com... I have a simple form that has a bunch of textboxes that show data from a dataset table.
When I "Add" a record with BindingManagerBase.AddNew(), all the textboxes go blank, so I can add a new record.
If I leave a field totally blank, and then click the Update button (which uses the DataAdapter.Update() command, I get an error saying:
"Field 'Orders.Email' cannot be a zero-length string"
Does .NET not allow zero-length strings?
I tried programmatically adding a space (" ") to the textbox like this:
If tbEmail.Text = "" Then tbEmail.Text = " " 'also tried tbEmail.text = chr(32) 'also tried tbEmail.text = vbnull End If
But after I get the error, this textbox still has no space in it.
I'm stumped. Can someone help?
Thanks! John
its most likely the database:
for instance, the northwind database has some fields where 'allow null' is
true, but 'allow zero length' is false.
in other words, you can put null in the field - but not an empty string -
--- moral of the story - check the database , modify your code to set the
fields to null rather than an empty string
HTH This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Grant Edwards |
last post by:
I finally figured out why one of my apps sometimes fails under
Win32 when it always works fine under Linux: Under Win32, the
pickle module only works with a subset of floating point
values. In particular the if you try to dump/load an infinity
or nan value, the load operation chokes:
Under Linux:
$ python
|
by: Steven T. Hatton |
last post by:
I mistakenly set this to the comp.std.c++ a few days back. I don't believe
it passed the moderator's veto - and I did not expect or desire anything
different. But the question remains:
ISO/IEC 14882:2003(E) §8.5 says:
To zero-initialize an object of type T means:
5...
|
by: Andreas Prilop |
last post by:
Jukka reports on
http://www.cs.tut.fi/~jkorpela/chars/spaces.html
that Internet Explorer 6 fails on the "zero width space" U+200B
Is this observation still valid? For which versions of MS Windows
does it apply? Does it depend on the encoding (charset)?
I have a test page in three encodings:...
|
by: I wish |
last post by:
#include <string.h>
int a;
memset( a, 0, sizeof(a) );
Does that guarantee all bits zero?
--
|
|
by: Zhiqiang Ye |
last post by:
Hi, All
I am reading FAQ of this group. I have a question about this:
http://www.eskimo.com/~scs/C-faq/q7.31.html
It says:
"
p = malloc(m * n);
memset(p, 0, m * n);
The zero fill is all-bits-zero, and does not therefore guarantee useful null
pointer values (see section 5 of this list) or floating-point zero values.
| |
by: pm940 |
last post by:
Hello.
I've been reading some past discussions on the NULL vs. zero.
References are always made to systems or machienes that use values
other than zero to represent the NULL pointer.
Although not a practice I follow, there are no doubt millions of lines
of open source libraries and applications that do things like:
p = malloc(...);
|
by: H.S. |
last post by:
Hello,
I am trying out a few methods with which to test of a given number is
practically zero. as an example, does the following test correctly if a
given number is zero within machine precision? I am trying out this
method to check for a practical zero in an algorithm I am implementing
in C++.
-------------------------
#include...
|
by: Hallvard B Furuseth |
last post by:
As far as I can tell, (x & -1) is nonzero if the integer x is
negative zero. So for signed types, x == 0 does not guarantee
(x & foo) == 0. Is that right? (Not that I expect to ever
encounter a non-two's-complement machine. Just wondering.)
--
Hallvard
|
by: DBC User |
last post by:
How would you develop a zero footprint application, is the smart
client application a zero footprint application?
Thanks.
|
by: Ajb181 |
last post by:
hi all. i have a template class that i can not link. there is no problem when i add the method def's inside the header file but as soon as i move them out i get a link error where i define the object. i have tryed a simple test of the same code and it links fine so am baffeled at what is happing
this is my simple test that complies and links
...
|
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...
| |
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. ...
|
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...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| |