473,571 Members | 3,049 Online
Bytes | Software Development & Data Engineering Community
+ 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_sett ings>
<setup>
<product1>
<name>PSO-NO2</name>
<mode>1</mode>
<setpoint>300.0 0</setpoint>
<range>12.00</range>
<density>10.630 0</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_setti ngs>

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.ReadXm l(strWorkPath & "\TreatmentSett ings.xml")
j = 0
For i = 1 to 2
For Each objDataRow In objDSXML.Tables (i).Rows
ControlMethod(j ) = objDataRow("mod e")
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(objDat aRow("mode")) Then
ControlMethod(j ) = objDataRow("mod e")
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 2497
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_sett ings>
<setup>
<product1>
<name>PSO-NO2</name>
<mode>1</mode>
<setpoint>300.0 0</setpoint>
<range>12.00</range>
<density>10.630 0</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_setti ngs>

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.ReadXm l(strWorkPath & "\TreatmentSett ings.xml")
j = 0
For i = 1 to 2
For Each objDataRow In objDSXML.Tables (i).Rows
ControlMethod(j ) = objDataRow("mod e")
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(objDat aRow("mode")) Then
ControlMethod(j ) = objDataRow("mod e")
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
1531
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 occured so rarely and I can not find the way that it was generated, so I can not debug the the exception. does anybody know how to generate this...
7
1687
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 give the error but the links does! I get the error on this LINE(when looping):- PageLinks.Text = PageLinks.Text & dtLinks.Rows(iLoop)("link_url")
5
8452
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
2328
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. If the user right clicks on a column heading can I highlight that column and then delete it? I'm not exactly sure how to highlight it or figure out...
0
1594
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. Has anyone seen this or have any suggestions? Event code: 3005 Event message: An unhandled exception has occurred. Event time: 9/5/2006 4:23:47...
4
15275
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. Has anyone seen this or have any suggestions? Event code: 3005 Event message: An unhandled exception has occurred. Event time: 9/5/2006 4:23:47...
2
5646
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) and type ?dedrow(c), It says basically the same thing: Run-time exception thrown : System.ArgumentException - Column 'TICKETNO' does not belong...
1
2236
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 ? Eg :- table master it has column masterid , mastername now i select masterid and assign it to new comlunm.
1
12132
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 same. You can say that other one is the copy of 1st one. I want to read out the data from one table in one database and merge the results with the one...
0
7732
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, 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...
0
7638
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...
0
8152
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7703
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...
1
5523
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5247
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
2136
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
1
1238
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
974
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.