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

Home Posts Topics Members FAQ

Column does not exist in DataTable Problem

Bob Ross
119 New Member
I have a very starange problem. I am trying to access a value from a datatable by specifying the column on the datarow but it keeps saying
"Column 'BitValue' is not cantained in table 'Fields'"
But it clearly is. All other columns work fine and I can reference it by number but not by name.

Expand|Select|Wrap|Line Numbers
  1. FieldsDS = FieldsSqlFactory.ExecuteQuery()
  2. FieldsDS.Tables(0).TableName = "Fields"
  3.  
  4. Dim AdditionalField As OrderingSpecificField
  5. Dim C As Integer = 0
  6. While C < FieldsDS.Tables(0).Rows.Count
  7.       Dim FR As DataRow = FieldsDS.Tables(0).Rows(C)
  8.  
  9.        'Check For which type of value & Build new Field by passing parameters to constructer
  10.         Select Case FR("FieldDataType")
  11.               Case "SpecificFieldDataType.bitValue"
  12.                   AdditionalField = New OrderingSpecificField(FR("ParentId"), FR("FieldIdentifier"), SpecificFieldDataType.bitValue, FR("FieldName"), FR("BitValue"), FR("TextValue"))
  13.               Case "SpecificFieldDataType.dateValue"
  14.                   AdditionalField = New OrderingSpecificField(FR("ParentId"), FR("FieldIdentifier"), SpecificFieldDataType.dateValue, FR("FieldName"), FR("DateValue"), FR("TextValue"))
  15.               Case "SpecificFieldDataType.floatValue"
  16.                   AdditionalField = New OrderingSpecificField(FR("ParentId"), FR("FieldIdentifier"), SpecificFieldDataType.floatValue, FR("FieldName"), FR("FloatValue"), FR("TextValue"))
  17.               Case "SpecificFieldDataType.intValue"
  18.                   AdditionalField = New OrderingSpecificField(FR("ParentId"), FR("FieldIdentifier"), SpecificFieldDataType.intValue, FR("FieldName"), FR("IntValue"), FR("TextValue"))
  19.               Case "SpecificFieldDataType.cboKeyValue"
  20.                   AdditionalField = New OrderingSpecificField(FR("ParentId"), FR("FieldIdentifier"), SpecificFieldDataType.cboKeyValue, FR("FieldName"), FR("CboKey"), FR("TextValue"))
  21.               Case Else
  22.                   AdditionalField = New OrderingSpecificField(FR("ParentId"), FR("FieldIdentifier"), SpecificFieldDataType.txtValue, FR("FieldName"), FR("TextValue"), FR("TextValue"))
  23.         End Select
  24.  
  25.         'add to Sample's collection of fields
  26.         SampleFields.Add(AdditionalField)
  27.         C += 1
  28. End While
It is the first case statement that causes problems.

If ANYONE could hepl I would much appreciate it.
Mar 6 '07 #1
2 2555
kenobewan
4,871 Recognized Expert Specialist
What database and platform are you using?
Mar 6 '07 #2
Bob Ross
119 New Member
Thanks for your reply.
But I got it working.
Stupid error managed to give the column a title of " BitValue" instead of "BitValue". DOH!
Mar 7 '07 #3

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

Similar topics

2
by: John Latten | last post by:
Hi there, I have got a problem when adding extra (= dummy) columns to a datagrid. I have a datagrid that is bound to a datatable. The datatable is filled with data from a SQL Server 2000...
6
by: Robert Schuldenfrei | last post by:
Dear NG, After being away from C# programming for a spell, I am trying my hand at what should be a simple task. I have been hitting my head against the wall this morning. I have a simple order...
2
by: MattB | last post by:
I know I can use dataviews and more looping to do this, but I'm wondering if there's a more elegant or more concise way to do this. I've got two DataTables with a column called guest_no. I'd love...
3
by: Gene Hubert | last post by:
I'm using DataTable.ImportRow to move data from one datatable to another... Dim dt, dtTarget As DataTable Dim dr As DataRow dt = DirectCast(Me.DataSource, DataTable) dtTarget = dt.Clone...
10
by: JohnR | last post by:
I have a datatable as the datasource to a datagrid. The datagrid has a datagridtablestyle defined. I use the datagridtablestyle to change the order of the columns (so they can be different than...
2
by: RSH | last post by:
Hi, Iam struggling with an application where I am trying to transfer a datarow from one sql server to another instance of sql server. The schmeas may be slightly different and I am getting an...
1
by: orenl | last post by:
I have a DataRow (from DataTable) and i want to get data from a column name that might not exist. public static object getObject(DataTable dataTable, int index, string columnName) { return...
4
by: =?Utf-8?B?TWlrZSBE?= | last post by:
I read the CSV file into a DataTable. This is so I can fix invalid dates and other data I don't want in the database. Then I use SqlBulkCopy to insert the data into the SQL database. All the...
9
by: evan1979.2 | last post by:
I am creating a new boolean column in a MSAccess .mdb database like this: Dim Cmd As New OleDb.OleDbCommand("ALTER TABLE m_table ADD boolColumn YesNo", objConn) Cmd.ExecuteNonQuery() , which...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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
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...
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...
1
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
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: 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 ...

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.