473,379 Members | 1,245 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

table merge error

I'm having difficulty with a function and can't find what the problem is.
The code is below. Essentially, it works fine if the target table (tbl
variable in code) is empty, however if it contains rows prior to the method
being called, the error "'column' argument cannot be null" is thrown on the
tbl.merge line. Any help would be greatly appreciated.

''' <summary>Imports data from the table passed in.</summary>

''' <returns>Number of successfully imported rows. Returns 0 for
error.</returns>

Public Function AppendDataTable(ByVal SourceDataTable As DataTable) As
Int32

If SourceDataTable Is Nothing Then

Return 0

End If

Try

Dim ds As DataSet = DirectCast(mBindingSource.DataSource, DataSet)

Dim tbl As DataTable = ds.Tables(mBindingSource.DataMember)

tbl.Merge(SourceDataTable, True, MissingSchemaAction.Ignore) '
error is thrown by this line

' some other stuff happens here specific to my code, but removed
for simplicity

Return SourceDataTable.Rows.Count

Catch ex As Exception

Return 0

End Try

End Function
Jan 26 '07 #1
3 3388
There's more than one way to skin a cat. Since I'm not actually merging
here and just adding all records from one datatable to another, I've got a
different route.

Replacing:

tbl.Merge(SourceDataTable, True, MissingSchemaAction.Ignore)

with:

For Each row As DataRow In SourceDataTable.Rows
tbl.ImportRow(row)
Next

Handles things nicely.
Jan 26 '07 #2
Hi Matt,

I am curious about your problem : )

I think the problem when you use the Merge method of DataTable may be
caused by the schema of the current DataTable and the DataTable to be
merged.

You may have a try passing False for the second parameter in the Merge
method, something like the following:

tbl.Merge(SourceDataTable, False, MissingSchemaAction.Ignore)

If the problem still exists, could you please send me a sample project that
could reproduce the problem? To get my actual email address, remove
'online' from my displayed email address.
Sincerely,
Linda Liu
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Jan 26 '07 #3
Linda,

Replacing the second parameter with "False" doesn't solve the issue. I've
sent email per your request.

"Linda Liu [MSFT]" <v-****@online.microsoft.comwrote in message
news:cn**************@TK2MSFTNGHUB02.phx.gbl...
Hi Matt,

I am curious about your problem : )

I think the problem when you use the Merge method of DataTable may be
caused by the schema of the current DataTable and the DataTable to be
merged.

You may have a try passing False for the second parameter in the Merge
method, something like the following:

tbl.Merge(SourceDataTable, False, MissingSchemaAction.Ignore)

If the problem still exists, could you please send me a sample project
that
could reproduce the problem? To get my actual email address, remove
'online' from my displayed email address.
Sincerely,
Linda Liu
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no
rights.

Jan 26 '07 #4

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

Similar topics

0
by: Johannes B. Ullrich | last post by:
--=-WKgoK98ejo9BZyGYc3N/ Content-Type: text/plain Content-Transfer-Encoding: quoted-printable I am having problems with MySQL 4.0.12 on RedHat Advanced Server 2.1 using a dual Xeon with 8...
8
by: Nils | last post by:
Hello, my problem: I merged about 1.000 Tables with Create table name (variables) type=merge union=(table1,table2,...,table1000); MySQL now creates a tables, but I can't open it....
3
by: jaykchan | last post by:
One of the table that is in a merge replication somehow is missing an index. Strangely, only the table in one of the subscriber of the merge replication is missing the index; another subscriber and...
2
by: William Wisnieski | last post by:
Hi Everyone, Access 2000 I have some code behind a button that performs a word merge with a query data source. The merge works fine. But what I'd like to do somehow is after the merge is...
1
by: Nedu N | last post by:
Hi All, I am facing problem in copying content of table from a untyped dataset into to a table inside the typed dataset. I wanted to copy the data into typed dataset in order to ease the further...
2
by: Gordon | last post by:
VB.Net 2003 Standard - Creating ASP.Net Web Application In design mode, I can drag a html table from the toolbox to the work area but I can't seem to be able to select individual cells or...
16
by: UDBDBA | last post by:
Hi All: I need some clarification on a MERGE statement. The database is on V8 FP12 (AIX) 64bit. The source table is tableA. The target is a View "FACT" with UNION ALL because of the 512 Gig...
0
by: John | last post by:
Hi I am handling DBConcurrencyException for an adapter manager using code below. My problem is how to merge table in error with its copy from underlying database. If I need the table's data...
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...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...

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.