473,480 Members | 1,814 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 2224
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
1560
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
2058
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
15853
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
1886
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
2308
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
2512
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
1021
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
5539
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
1839
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
5433
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
6903
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
7027
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
7071
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
6726
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...
1
4763
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4468
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
2987
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
1291
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 ...
0
170
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.