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. - FieldsDS = FieldsSqlFactory.ExecuteQuery()
-
FieldsDS.Tables(0).TableName = "Fields"
-
-
Dim AdditionalField As OrderingSpecificField
-
Dim C As Integer = 0
-
While C < FieldsDS.Tables(0).Rows.Count
-
Dim FR As DataRow = FieldsDS.Tables(0).Rows(C)
-
-
'Check For which type of value & Build new Field by passing parameters to constructer
-
Select Case FR("FieldDataType")
-
Case "SpecificFieldDataType.bitValue"
-
AdditionalField = New OrderingSpecificField(FR("ParentId"), FR("FieldIdentifier"), SpecificFieldDataType.bitValue, FR("FieldName"), FR("BitValue"), FR("TextValue"))
-
Case "SpecificFieldDataType.dateValue"
-
AdditionalField = New OrderingSpecificField(FR("ParentId"), FR("FieldIdentifier"), SpecificFieldDataType.dateValue, FR("FieldName"), FR("DateValue"), FR("TextValue"))
-
Case "SpecificFieldDataType.floatValue"
-
AdditionalField = New OrderingSpecificField(FR("ParentId"), FR("FieldIdentifier"), SpecificFieldDataType.floatValue, FR("FieldName"), FR("FloatValue"), FR("TextValue"))
-
Case "SpecificFieldDataType.intValue"
-
AdditionalField = New OrderingSpecificField(FR("ParentId"), FR("FieldIdentifier"), SpecificFieldDataType.intValue, FR("FieldName"), FR("IntValue"), FR("TextValue"))
-
Case "SpecificFieldDataType.cboKeyValue"
-
AdditionalField = New OrderingSpecificField(FR("ParentId"), FR("FieldIdentifier"), SpecificFieldDataType.cboKeyValue, FR("FieldName"), FR("CboKey"), FR("TextValue"))
-
Case Else
-
AdditionalField = New OrderingSpecificField(FR("ParentId"), FR("FieldIdentifier"), SpecificFieldDataType.txtValue, FR("FieldName"), FR("TextValue"), FR("TextValue"))
-
End Select
-
-
'add to Sample's collection of fields
-
SampleFields.Add(AdditionalField)
-
C += 1
-
End While
It is the first case statement that causes problems.
If ANYONE could hepl I would much appreciate it.
2 2573
What database and platform are you using?
Thanks for your reply.
But I got it working.
Stupid error managed to give the column a title of " BitValue" instead of "BitValue". DOH!
Sign in to post your reply or Sign up for a free account.
Similar topics |
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 database. This data contains a column that is a foreign key to another table. In my datagrid I don't want to display this keyvalue. Instead I want to use this key to get a description out of another table.
I have added an extra column to both the...
|
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 entry application. The code below gets
line items from a SQL Server database and returns them to a datagrid by way
of a DataTable called lineTable. As long as I am just displaying columns in
the SQL database everything works well. I now want...
|
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 to be
able to use something like the .IndexOf method of arrays and bound
controls. Somehting like:
Dim r as DataRow
For Each r in DataTable2.Rows
If DataTable1.Columns("guest_no").IndexOf(r("guest_no")) <> -1
|
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 'copy the data structure
dtTarget.DefaultView.Sort = String.Empty 'remove the sort
|
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 the column order of the
datatable). I also allow the user to click on a column header to sort the
datagrid by that column.
I need to identify the row and column in the datatable when the user clicks
on a cell in the datagrid.
Using the...
| |
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 exception when they are different.
Is there anyway i can modify the code below so that if the schemas are
different I can drop the offending column in the appropriate datatable?
Thanks,
Ron
|
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 dataTable.Rows;
}
|
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 rows are being read and
inserted into the table. The problem is that one of the columns in the CSV
contains the value of 1 thru 6 or C, BUT only the numbers seem to be read
into the DataTable not the letter. I tried single quotes and double quotes...
|
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 works fine. But... when the .mdb file is opened in Access the
values for the new column are shown as "-1" and "0"...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
| |
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 we have to send another system
| |