2

I'm having some trouble with Visual Studio and the creation of DataSets from a database.

Whenever I create a new TableAdapter, the Insert-Methods parameters are, lets just say, it messes up.

The database is a MS Access 2000 Database file. If I create a new TabelAdapter, everything works just fine. I select to create DatabaseDirect Methods and it all goes through without errors.

Then, I look at the statements. All perfectly fine. But then, I check the Insert-Methods parameters and I see this:

Parameter List http://img243.imageshack.us/img243/3175/paramlist.png

All the parameters are set to default Strings with no name. I have to rename and define all of their types over again.

Interesting thing is, this does never affect the last parameter (As you see: Comment is not renamed etc) and it only happens to the Insert-Method. When I check the Update-Method (which also uses the exact same parameters), they are all correctly named and the type also fits the one in the databse.

Parameter list http://img816.imageshack.us/img816/853/paramlistnormal.png

Is this a known bug? Did I do something wrong when creating the TableAdapter?

You see, it's not that big an issue, I just can't understand why it works with every other method, just not the Insert and it is quite a fuss to rename and retype all of the parameters if you create a table adapter for a table that has significantly more fields than just the 12 I showed you.

Simon Hayter
  • 3,131
  • 27
  • 53
F.P
  • 17,421
  • 34
  • 123
  • 189
  • If this problem applies to other data sources, there's no real reason for the MS-ACCESS tag. On the other hand, if it's specific to Jet/ACE data sources, the tag should stay. From where I sit (as an Access developer), this looks entirely like a VS problem, unrelated to Access at all. – David-W-Fenton Sep 10 '10 at 19:25
  • It does in fact only happen with Access databases. – F.P Sep 17 '10 at 10:35
  • I wonder whether this is somehow related to Jet's implicit handling of SQL parameters. I'm not very familiar with TableAdapters because I generally use dao when I need access to an mdb in C#. If I have some time tomorrow, I'll look into it. – phoog May 04 '11 at 07:22
  • I know it's not really a devastating issue, but the longer I work on this the more annoyed I get. When creating a new adapter I always have "damn, insert statement but again" in the back of my head and it just ***** me off... – F.P May 04 '11 at 07:33
  • Surely this is because the OLEDB driver for Jet/ACE does not allow named parameters? Or maybe I'm misinterpreting the context... – David-W-Fenton May 06 '11 at 03:18
  • [Similar problem here](http://stackoverflow.com/questions/4244255/lost-parameter-names-in-tableadapter-generated-insert-method). Maybe the answer in that question may at least make it easier for you to edit the names (via XML file instead of in the GUI window). – Zabba May 06 '11 at 22:33

1 Answers1

0

It looks like at least one other person has had a similar problem. Although this post doesn't specifically mention Access, the symptoms seem to be the same as what you've seen.

Unfortunately, there wasn't a clear solution listed there. The OP only says that he was able to call the automatically-generated Insert command, rather than trying to create his own Insert query, and so he did not need to resolve his original issue.

Also, he mentions that everything seems to work fine with all of the other tables in his database, and that this happens with only one table. That may mean that it's not an Access-specific issue, but rather that the tables in your database have something in common with the table in this post, and that common factor is what is preventing the TableAdapter from working as it should.

Dave DuPlantis
  • 6,378
  • 3
  • 26
  • 30