Data binding question

  • Thread starter Thread starter cypher_key
  • Start date Start date
C

cypher_key

I want to write a simple application for my own use. I've already have
the data populated in a database and I have a data source setup.

I can use the wizards to generate a master detail data form (I believe
that's what it's called) and I get a form with input controls for each
field in the table. My question is that 2 of the fields in the table
are numeric IDs which are foreign keys to other tables. For example, I
have a customerID and registrationID field. I don't want text box
controls for those fields, but rather a combo box control that
displays the a field in the customer table. I did make this work by
changing the SQL query for the data set to use a join, however the
wizard obviously isn't able to generate the update statements.

I've tried to search google for this, since I do want to RTFM, however
I'm not really sure what to look for. Suggestions on the appropriate
concept that I should search would be greatly appreciated.
 
Hi cypher_key,

I see this is basically a recycled version of your "wizard or not wizard"
question from a couple of days ago. I suspect that didn't get answers - and
neither will this rendition - because most developers here don't know the
answer to your specific question about getting the desired behavior WHILE
using the wizards to generate the code. I have never seen or heard of
developers relying on VS wizards to generate code for purposes like yours -
at least not for "real" production apps. It might happen - I just haven't
seen or heard of it. Too much control is lost and the code generated by
wizards (at least that I have seen) usually makes a bunch of assumptions
about architecture that are probably invalid for a real production app - so
you can't really use wizard-generated code even for a head-start.

What I would recommend is learning how to write the code yourself. It's
really not all that difficult or time consuming. Learn ADO.NET's basic
objects relevant to whatever data source you are using. If Sql Server, then
you'd learn about the SqlCommand, SqlDataAdapter and it's 4 Command
properties (InsertCommand, UpdateCommand, DeleteCommand, SelectCommand),
etc. You'd also learn about ODO.Net's "disconnected" objects - like
DataTable and DataSet. You *could* then bind your UI controls to your
DataTables - which can hold multiple versions of the source data (original,
updated, deleted, inserted, etc). Odds are that the wizard is generating
some ADO.NET code for you (but I don't really know, as I haven't ever used
the wizard you speak of).

Sorry I couldn't be more helpful on your specific issue... but it's a shot
at least at explaining why you didn't get any answers on the original
version of the question. If you start writing code of your own, then get
stuck, at least you'll be able to tell us what code you do have and what
your particular objective is with that code and where you got stuck. Then we
can help you to get unstuck.

HTH

-S
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top