473,473 Members | 2,357 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

NULLS values and text box values

I have a text box on a web form that a user enters a number in.

If they blank out the text box then I want to put a null value back into the
database field.

I want to return the value to NULL like txtWaterDischargeRate =
System.DBNull.Value instead of Nothing but I get an error

Can't convert NULL to integer

How can I enter a null in the database field on MS SQL Server?

Thanks
Aug 23 '05 #1
4 2223
Would be helpful if you showed us the code running that is causing the
error...

"Craig" <No****@hotmail.com> wrote in message
news:uh**************@tk2msftngp13.phx.gbl...
I have a text box on a web form that a user enters a number in.

If they blank out the text box then I want to put a null value back into
the database field.

I want to return the value to NULL like txtWaterDischargeRate =
System.DBNull.Value instead of Nothing but I get an error

Can't convert NULL to integer

How can I enter a null in the database field on MS SQL Server?

Thanks

Aug 23 '05 #2
Sample code......

With DataSetLocationsForm1.tblLocations(0)
.WaterDischargeCost = txtWaterDischargeCost.Text
.MoreFields = txtOtherTextboxes.Text
End With
SqlDataAdapter1.Update(DataSetLocationsForm1)

The WaterDischargeCost field in the database is an type real. If they blank
out the text box and click the SAVE button on an existing record I get an
error "Can't convert NULL to integer"

I want to put a null value back into the database field

How do I do this?

Thanks

SqlDataAdapter1.Update(DataSetLocationsForm1)
"Marina" <so*****@nospam.com> wrote in message
news:eY**************@TK2MSFTNGP09.phx.gbl...
Would be helpful if you showed us the code running that is causing the
error...

"Craig" <No****@hotmail.com> wrote in message
news:uh**************@tk2msftngp13.phx.gbl...
I have a text box on a web form that a user enters a number in.

If they blank out the text box then I want to put a null value back into
the database field.

I want to return the value to NULL like txtWaterDischargeRate =
System.DBNull.Value instead of Nothing but I get an error

Can't convert NULL to integer

How can I enter a null in the database field on MS SQL Server?

Thanks


Aug 23 '05 #3
If the column WaterDischargeCost is nullable (minoccurs = 0), then you can use:
DataSetLocationsForm1.tblLocations(0).SetWaterDisc hargeCostNull()

to let the dataset set the value as null.


"Craig" wrote:
Sample code......

With DataSetLocationsForm1.tblLocations(0)
.WaterDischargeCost = txtWaterDischargeCost.Text
.MoreFields = txtOtherTextboxes.Text
End With
SqlDataAdapter1.Update(DataSetLocationsForm1)

The WaterDischargeCost field in the database is an type real. If they blank
out the text box and click the SAVE button on an existing record I get an
error "Can't convert NULL to integer"

I want to put a null value back into the database field

How do I do this?

Thanks

SqlDataAdapter1.Update(DataSetLocationsForm1)
"Marina" <so*****@nospam.com> wrote in message
news:eY**************@TK2MSFTNGP09.phx.gbl...
Would be helpful if you showed us the code running that is causing the
error...

"Craig" <No****@hotmail.com> wrote in message
news:uh**************@tk2msftngp13.phx.gbl...
I have a text box on a web form that a user enters a number in.

If they blank out the text box then I want to put a null value back into
the database field.

I want to return the value to NULL like txtWaterDischargeRate =
System.DBNull.Value instead of Nothing but I get an error

Can't convert NULL to integer

How can I enter a null in the database field on MS SQL Server?

Thanks



Aug 24 '05 #4
Awesome. Exactly what I was looking for!

Thanks
"holstad" <ho*****@discussions.microsoft.com> wrote in message
news:DB**********************************@microsof t.com...
If the column WaterDischargeCost is nullable (minoccurs = 0), then you can
use:
DataSetLocationsForm1.tblLocations(0).SetWaterDisc hargeCostNull()

to let the dataset set the value as null.


"Craig" wrote:
Sample code......

With DataSetLocationsForm1.tblLocations(0)
.WaterDischargeCost = txtWaterDischargeCost.Text
.MoreFields = txtOtherTextboxes.Text
End With
SqlDataAdapter1.Update(DataSetLocationsForm1)

The WaterDischargeCost field in the database is an type real. If they
blank
out the text box and click the SAVE button on an existing record I get an
error "Can't convert NULL to integer"

I want to put a null value back into the database field

How do I do this?

Thanks

SqlDataAdapter1.Update(DataSetLocationsForm1)
"Marina" <so*****@nospam.com> wrote in message
news:eY**************@TK2MSFTNGP09.phx.gbl...
> Would be helpful if you showed us the code running that is causing the
> error...
>
> "Craig" <No****@hotmail.com> wrote in message
> news:uh**************@tk2msftngp13.phx.gbl...
>>I have a text box on a web form that a user enters a number in.
>>
>> If they blank out the text box then I want to put a null value back
>> into
>> the database field.
>>
>> I want to return the value to NULL like txtWaterDischargeRate =
>> System.DBNull.Value instead of Nothing but I get an error
>>
>> Can't convert NULL to integer
>>
>> How can I enter a null in the database field on MS SQL Server?
>>
>> Thanks
>>
>
>


Aug 24 '05 #5

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

Similar topics

0
by: Rhino | last post by:
I am working with SQL Functions in DB2 for Windows/Linux/UNIX (V8.2.1) and am having a problem setting input parameters for SQL Functions to null in the Development Center. My simple function,...
1
by: PST | last post by:
Here's a problem I'm trying to deal with: I'm working on a Frontpage 2000 website for a boat handicapping system, built in Access 97. What I'm trying to accomplish is: The user enters a...
2
by: Rey | last post by:
Howdy all. My problem deals w/inserting nulls into database (SQL Svr 2K) for the datetime fields activityDate and followUpDate where nulls are allowed. >From the web form, the user can type...
14
by: tshad | last post by:
I have people telling me that I should set up objects for my tables, but I am finding the Null problem makes that difficult. It isn't a big problem if you are not updating the table, but if you...
8
by: Mike | last post by:
The current databas structure that i'm working with allowed NULL's an now I'm converting the app to .NET and it will not allow NULLs in the fields when populated. So my question is, how can i...
4
by: Edmund Dengler | last post by:
Howdy all! Just checking on whether this is the expected behaviour. I am transferring data from multiple databases to single one, and I want to ensure that I only have unique rows for some...
2
by: Adam Knight | last post by:
Hi all, Just wondering how everybody goes about dealing with db nulls when binding form controls to db data. The code below produces an error if any column in the reader object contains a db...
8
by: shira | last post by:
I have done a fair bit of searching, but haven't yet been able to find an explanation as to why one would set "ignore nulls" to "yes" when creating an index. I understand what it does (I think),...
6
by: othellomy | last post by:
create table t1(c1 int, c2 varchar(10)) insert t1 values(1,'Hello') insert t1 values(2,'') insert t1 values(3,NULL) select * from t1 c1 c2 1 Hello
6
by: Cliff72 | last post by:
I need to fill in the nulls in the batch field the value from the record immediately preceding the null one ie replace the nulls with the preceding value until I hit a record with a value in...
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
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...
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
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: 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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
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...

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.