473,385 Members | 1,907 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Object can not be cast from the DBNull to the other type errors

3
HI,

There are 2tables in the "mydatabse".

1. Tools
2. ToolsRepair

there are some columns in the above two tables.

Toolid is the primary key of the Tools table and also FK for the ToolsRepair
and also there are some other columns in the two tables

I am trying to insert the all details of the ToolsRepair table using that FK_ Toolid

but I am getting the error,

Cannot insert the value NULL into column 'Tool_id', table 'ToolApp.dbo.ToolsRepair'; column does not allow nulls. INSERT fails. The statement has been terminated.

please help me out...
thanks in advance
Mar 12 '10 #1
3 1588
tlhintoq
3,525 Expert 2GB
The table doesn't allow nulls. You want to use a null. What advice do you want? The table won't allow it. Put in something else.
Mar 12 '10 #2
10533
3
Thank you, thats I understand, am new to C sharp coding

SO could you please explain me more clearly??

thanks.
Mar 12 '10 #3
tlhintoq
3,525 Expert 2GB
No. I don't think I could be any more clear than that.

If the table doesn't allow nulls, then you can't force it to accept them.

Database How-to parts 1 and 2
Database tutorial Part 1
Database tutorial Part 2
Mar 12 '10 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: tshad | last post by:
The error I am getting is: ******************************************************************* Exception Details: System.InvalidCastException: Cast from type 'DBNull' to type 'String' is not...
1
by: David Lozzi | last post by:
Howdy, I am trying to accomplish the following: dim DateSend as date if txtDateSend.text = "" then DateSend = dbnull.value else DateSend = txtDateSend.text
15
by: David | last post by:
Hi, I have built a web application that will be a very high profile application. We had tested it, demonstrated it and shown that it all works. On a dress rehearsal run through, it failed...
8
by: | last post by:
I have the following class : Public Class MyTreeNode Inherits TreeNode Dim mystring As String End Class Now, when I try to do this : ''''''''''''nodes is a TreeNodeCollection, s is string
8
by: Vik | last post by:
I need to make some calculations, e.g. addition, on the objects x and y which are numbers (of the same or different types) and may be DBNulls. In VB, the following code is correct: Public Shared...
8
by: akolsen | last post by:
Hello there. This should be simple, but im having trouble anyway of getting it to work. I have a boxed object that i want to cast to its native type, but I would like to use reflection to do...
2
by: DMG | last post by:
Why does this fail with a cast exception? The field is coming in from the data base as null due some bad design on my part but I thought this would allow me to test and set to false. ...
6
by: scott ocamb | last post by:
Hello, I have a function that expects the following parms. How can I handle null values. For example, if FirstName comes through as null, how can i propogate that null value to the stored...
9
by: patrick.sannes | last post by:
Hi, I have a question. I have a stored procedure that can give a value like a string or an int. But in some cases it can be DBNull. What is the standard way to handle this? - I can create a...
1
by: =?Utf-8?B?QkpT?= | last post by:
I have written a Generic method that takes an object, a type, T, and returns a System.Nullable (Of T) depending on whether or not the object IsDBNull. It was working fine until I tried to pass a...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...

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.