Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Another Newbie Question
Message
From
21/10/2008 14:16:11
 
 
To
21/10/2008 08:20:22
General information
Forum:
ASP.NET
Category:
Databases
Environment versions
Environment:
VB 9.0
OS:
Vista
Network:
Windows 2008 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01355730
Message ID:
01356132
Views:
21
Bill,

I was never one to trust wizards, I avoid them whenever possible. =0) We do all our database updating manually ... no TableAdapters, no SqlCommandBuilder, no DataAdapter.Update() (we use the DataAdapter, you kinda have to ... but we don't use the .Update() method of it). Just a few generic methods that we've developed and some standards that all our developers use.

About the only thing that I let Visual Studio generate for me (because it's silly to do *everything* yourself by hand) is IDE-generated UI stuff (for forms/usercontrols), Web References for using our Web Services and Typed DataSets. That's it.

Doing it yourself increases your understanding of what's going on anyway ... all that wizard stuff only hides what you'd code yourself if you understood it better. The one thing that I see good about a wizard or auto-generated stuff is, in fact, as a learning tool to see how to do some stuff. You can usually figure out a better way to do it once you understand the process.

~~Bonnie





>Bonnie
>
>
>Thanks for your reply.
>
>No, this is a single table update. This is a learning exercise and that's all this program does. I have a two field SQL table with an identity field and a character field and I want to be able to service that table.
>
>I created a dataset, created a form, added the textboxes and added a bindingnavigator.
>
>There is no other code. I just ran the form.
>
>The tableadapters and tableadaptermanagers and a bindingsource appeared on their own after I installed the bindingnavigator and bound some SQL fields to my text boxes.
>
>> suspect the problem is because you haven't defined the proper select/update/insert/delete commands when you defined your TableAdapters.
>
>Yes, that was the problem. The wizard was supposed to have generated those commands and it didn't.
>
>Google revealed that it's a common problem. Several mentioned that a common cause is the absence of a primary key in the project's schema for the table, so I designated the identity field as a primary key in the dataset designer and redid the wizard, to no avail. I tried making a brand new project with a primary key, still no luck.
>
>Many people on Google gave up and used dbcommandbulder to create the commands. Others said that they always created the commands themselves in code.
>
>After stumbling around with the dbcommandbuilder class, I gave up and wrote some code that added the update command to the dataadapter myself before running the update method, and that solved the problem.
>
>
>>However, you can configure the INSERT, UPDATE and DELETE commands manually in the Properties window.
>
>That would have been good, but I couldn't find a place to do it. I could only see a way to change the fill command, but not the others. How do I get that Properties window?
>
>I'm wondering if the identity field is confusing the wizard.
>
>Next, I plan to try a new project with the same table, but with no navigator and some bound text boxes, and my own Forward, Back and Save buttons.
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Reply
Map
View

Click here to load this message in the networking platform