|
-
May 8th, 2013, 01:10 PM
#6
Thread Starter
Addicted Member
Re: How to cast datakey in a DataBinding
@dunfiddlin
I think that extremely unlikely. Databases generally make no distinction between numeric types. A number is a number is a number.
I'm not sure I understood your point, but the fact is, that in the table in which a column contains a reference key to the other tables ID, the reference key column is defined as DOUBLE. Access says "If joining this field to a AutoNumber field in a many-to-one relationship, this field must be Long Integer". Nevertheless, the join with the Double field works in Access.
BUT, probably the error I received was not due to this worng datatype in the column. Only after I have set up the cast( by adding the corresponding column to the DataTable and setting its DataType to Integer, before filling the table throught the OleDBAdapter):
Code:
Dim skPakas As New DataTable()
skPakas.Columns.Add(New DataColumn("heap_id"))
skPakas.Columns("heap_id").DataType = GetType(Integer)
da.Fill(skPakas)
myGrid2BindingSource.DataSource = skPakas
which works fine and the data is filled while type Integer is preserved, I kept getting the error. Then I found out, that my alternative choices combobox, does not contain all possible values from the referencing table, and the error probably came from this and not from the misdatatyped reference key column. So I solved one problem, which probably didn't even cause the error.
@jmcilhinney
Would this additional column be bound in both directions (read/write) to the original column? Thanks anyway, but most probably the problem I wanted to solve was never a problem.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|