Question how to insert a null value from db to db

Raddict

Active member
Joined
May 19, 2005
Messages
28
Location
Rotterdam (Holland)
Programming Experience
3-5
Hi,

it's been a while but I'm burning my fingers once again on databases :)

I'm trying to make a tool that copies records from one database to another similar database (SQL).

I made a form containing 2 datagrids, one as source and the other as target.

I try to use:

VB.NET:
Me.ToolTableAdapter.Insert(DataGridView1.Item(1, 0).Value, DataGridView1.Item(2, 0).Value, DataGridView1.Item(3, 0).Value

But DataGridView1.Item(2, 0).Value for instance has no value. This seems to result in a "invalid cast exeption".

the type for the value is system.nullable(of short) according to vb.net

I hope someone can shed some light on this.
 
Is it your primary key? Are you trying to sort it?
That should have been System.DBNull.Value and not System.DBNull.Value().
 
Please explain why you list yourself as using VS2003 which doesnt have TableAdapters yet your code specifically uses a TableAdapter

If you have upgraded your Visual Studio, please update your profile
 
Back
Top