Microsoft.ApplicationBlocks.Data

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi

I am using the v2.0 FillDataset method with a pre-existing typed dataset. 1
or 2 tables seems to work fine, but 3 or more do not fill the pre-existing
tables, but add new tables Table2, Table 3 instead.

I thought this was stange so went back to the supplied sample VB project,
added some more tables and got exactly the same problem?

Any ideas?
 
Hi Terry,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that when you use FillDataset method, the
data will not be filled to pre-defined table,but created new tables in .net
framework 2.0. If there is any misunderstanding, please feel free to let me
know.

Since .net framework 2.0 hasn't been released, it's only a beta version.
For .net framework 2.0 questions, please try to post in the following
newsgroup.

http://communities.microsoft.com/newsgroups/default.asp?icp=whidbey&slci
d=us

Thank you!

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
Hi Terry,

I didn't notice that you're using Data Access Application Block 2.0 and
might have delivered wrong information in my last post in this thread.
Apologize.

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you're using SQLHelper.FillDataSet
method to fill the data to a strong typed DataSet. If there is any
misunderstanding, please feel free to let me know.

As far as I know, there is an overload for FillDataset method defined as
below.

public static void FillDataset(SqlConnection connection, string
spName,
DataSet dataSet, string[] tableNames,
params object[] parameterValues)

You can try to add a string array for the 4th argument to specify the
mapping names. Also, could you let me know if you're filling multiple
tables into a DataSet with a single fill? IMO, it's better to fill one
table with a FillDataset call.

HTH. If anything is unclear, please feel free to reply to the post.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
Hi Kevin

Thanks for the reply.
I am using the exact overload you stated as follows:

Dim strTables() As String = {"Products", "Shippers", "Suppliers",
"Territories"}
SqlHelper.FillDataset(connection, CommandType.StoredProcedure, "getStuff",
productDS, strTables, New SqlParameter("@CategoryID", 1))

The getStuff stored procedure then performs 4 selects on the tables listed
above in the same order. I have also tried splitting the stored procedures up
and executing each from the getStuff sp. But for some reason the Products and
Shippers tables are filled, but the Suppliers and Territories are not, but
instead 2 new tables called Table2 and Table3 are created and filled.

Similarly if I reorder the tables as "Suppliers", "Territories", "Products",
"Shippers" in both the table array and the getStuff stored procedure then the
Suppliers and Territories are filled and the Products and Shippers are not,
but again 2 new tables Table2 and Table3 are created.

Strange, but true!
 
Hi Kevin

I have found the bug in the ApplicationBlocks.Data code. In the final
overload of the FillDataset method, the following code:

-------------------------------------------------------
Dim tableName As String = "Table"
Dim index As Integer

For index = 0 To tableNames.Length - 1

If (tableNames(index) Is Nothing OrElse tableNames(index).Length = 0)
Then Throw New ArgumentException("The tableNames parameter must contain a
list of tables, a value was provided as null or empty string.", "tableNames")

dataAdapter.TableMappings.Add(tableName, tableNames(index))

tableName = tableName & (index + 1).ToString()

Next
----------------------------------------------------

change the line to:

tableName = "Table" & (index + 1).ToString()

Obviously before it was producing "Table", "Table1", "Table12", "Table123"
etc! and therefore the first 2 tables mapped are OK and the rest not.

Is there a place to send this to so that Microsoft update their code?
 
Hi Terry,

Thank you very much for your feedback. Since the Application Block is open
source, you can just modify it an rebuild the assembly to make it work. I
will help you to report this to the appropriate team.

Thanks!

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
Back
Top