473,466 Members | 1,613 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Column does not belong to Table error

Hi all,
>From vb.net 2005, I'm reading a list of XML files into a dataset and
updating SQL database with the data.I'm stuck with an issue. One of the
XML file from the list don't have a node mentioned. For example almost
all XML files structure is like this

<treatment_settings>
<setup>
<product1>
<name>PSO-NO2</name>
<mode>1</mode>
<setpoint>300.00</setpoint>
<range>12.00</range>
<density>10.6300</density>
<tr_pf>300.00</tr_pf>
<tp_pf>10.00</tp_pf>
</product1>
<product2>
<name />
<mode>0</mode>
<setpoint>80.00</setpoint>
<range>4.00</range>
<density>9.4300</density>
<tr_pf>300.00</tr_pf>
<tp_pf>10.00</tp_pf>
</product2>
</setup>
</treatment_settings>

But few liles don't have <modenode for product2. In that case I'm
getting Column does not belong to table error when I'm executing the
below code. I'm trying to save values into arrays and later in the code
I'm updating the database.
__________________________________________________ __
objDSXML.ReadXml(strWorkPath & "\TreatmentSettings.xml")
j = 0
For i = 1 to 2
For Each objDataRow In objDSXML.Tables(i).Rows
ControlMethod(j) = objDataRow("mode")
ProductName(j) = Trim(objDataRow("name"))
j = j + 1
Next
Next
__________________________________________________ __
I have tried using this code to see if the node exist.

If Not IsDBNull(objDataRow("mode")) Then
ControlMethod(j) = objDataRow("mode")
End If

Above code didn't work eiter.
Can any one tell me how to check if a node in the table exist?

Thanks.

Jan 9 '07 #1
1 2488
in the Table.Columns collection to see if the column exists. you could
also add the column if missing.

-- bruce (sqlwork.com)

shil wrote:
Hi all,
>>From vb.net 2005, I'm reading a list of XML files into a dataset and
updating SQL database with the data.I'm stuck with an issue. One of the
XML file from the list don't have a node mentioned. For example almost
all XML files structure is like this

<treatment_settings>
<setup>
<product1>
<name>PSO-NO2</name>
<mode>1</mode>
<setpoint>300.00</setpoint>
<range>12.00</range>
<density>10.6300</density>
<tr_pf>300.00</tr_pf>
<tp_pf>10.00</tp_pf>
</product1>
<product2>
<name />
<mode>0</mode>
<setpoint>80.00</setpoint>
<range>4.00</range>
<density>9.4300</density>
<tr_pf>300.00</tr_pf>
<tp_pf>10.00</tp_pf>
</product2>
</setup>
</treatment_settings>

But few liles don't have <modenode for product2. In that case I'm
getting Column does not belong to table error when I'm executing the
below code. I'm trying to save values into arrays and later in the code
I'm updating the database.
__________________________________________________ __
objDSXML.ReadXml(strWorkPath & "\TreatmentSettings.xml")
j = 0
For i = 1 to 2
For Each objDataRow In objDSXML.Tables(i).Rows
ControlMethod(j) = objDataRow("mode")
ProductName(j) = Trim(objDataRow("name"))
j = j + 1
Next
Next
__________________________________________________ __
I have tried using this code to see if the node exist.

If Not IsDBNull(objDataRow("mode")) Then
ControlMethod(j) = objDataRow("mode")
End If

Above code didn't work eiter.
Can any one tell me how to check if a node in the table exist?

Thanks.
Jan 10 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: mkomasi | last post by:
I am using a datagrid in my form sometimes when a child form of this datagrid form closed an exception like "Column C does not belong to the table T" was thrown. this exception is rarely...
7
by: Patrick Olurotimi Ige | last post by:
I have a simple Stored Procedure with multiple select statements..doing select * from links for example. I created a DataTable and then fill the tables But the first dtTemplate DataTable doesn't...
5
by: Kejpa | last post by:
Hi, How do you write a Rowfilter for a boolean column? col1=true col1='true' col1= 1 col1= -1 Will all render an exception: Column 'col1' does not belong to table Test. Any thoughts?
10
by: Nick | last post by:
Hello, Please pardon my ignorance as I'm sure this is easy to do. I have a datagrid where I want to let the user delete columns. I added a context menu to the datagrid that has a delete option....
0
by: Mike | last post by:
We are using .NET 2.0 and intermittently egt the following errors on almost all our web pages. The error is not repoducable and cycling the worker process seems to temporarily fix the problems. ...
4
by: Mike | last post by:
We are using .NET 2.0 and intermittently egt the following errors on almost all our web pages. The error is not repoducable and cycling the worker process seems to temporarily fix the problems. ...
2
by: Ronald S. Cook | last post by:
In the code below, I get a runtime error where indicated. The error is: "Column 'TICKETNO' does not belong to table TICKET_DEDUCTIONS." If I put a breakpoint on that line (so not yet executed)...
1
by: satishkhachane | last post by:
-------------------------------------------------------------------------------- I want to select one or more columns from one typed datatable and add it to another table . how I can do this ? ...
1
by: majidkorai | last post by:
Hey Guyz I am having problem when i read the data from a datareader into a data table. The whole scenario is this that I want to read data from two diffrent databases, the table strcutre is...
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
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
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,...
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
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: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
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.