ADO.NET 2.0 Love it or die from it!!!

G

Guest

Hi.
When I move to VS.NET 2003 I find very challenging than since march 2005 I
had big problem doing a report with IBM AS400 and luckily I finished. I get 5
days of to study new ADO.NET 2.0 with VS.NET 2005 Professional edition. It
was expensive but I find I can do many things much easier than previous one.

First I create a database using SQL Server 2000 (I guess I am chicken to
move on SQL Server 2005) and had only 3 tables as Customer, Products and
Orders.

I use the wizard to create and see how easy and fast to create a input
windows form and it was very good and very fast. Not only I get details form
also I place a data grid and love to see the “BindingNavigatorâ€.

Now when I try to make another form for Orders tables I get many
difficulties so I guess I have to love the new ADO.NET or I might going to
kill myself! Last 2 days I couldn’t sleep and I was searching many books and
articles on the net to find some good example for my problem to solve it.

The orders form has 2 specific columns that show the Customer ID and Product
ID.
The data grid view was okay but I was stuck on the “Details†section.

Only Data sources tab I choose both column to show as combo Box. And it is
okay when I view but when I click the “BindingNavigator†ADD btn I couldn’t
mange to fill customer name and product name.

What I need was to when I click the add button on the “BindingNavigator†I
need to fill the 2 combo boxes with Customer name and Product name. And then
when I click the SAVE btn on the “BindingNavigator†I want to save my orders
but the Customer Name and Product Name must be somehow converted to integer
so I can place them in my SQL tables. In Order tables in my SQL server has
set to accept integer value for Customer ID and Product ID.

So how to mange to get this work? Or does anyone know good article about
this problem that can share with me?

Thank you very much for reading my mail and I hope I can get quick response
to my post.

Rgds,
GC
 
C

Cor Ligthert [MVP]

Niyazi,

A pity you are probably not able to read Dutch, this month I wrote an
article about this in the Net magazine but it was in Dutch.

Basicly it was done based on this
http://www.vb-tips.com/dbpages.aspx?ID=1139f14a-c236-4ad7-8882-b1ed16424252

In short for what you ask, you have after this to add the needed extra
tables to the datasource (Data->Datasources), than change using the designer
the boxes in the grid and set the datasource of those. Add the same moment
there will for you created another datasource and bindingnavigator. (In my
article is as well the rollback by errors).

I hope this helps,

Cor
 
G

Guest

Hi Cor,

Thank you very much for your quick response again. Sorry I cannot read
Dutch, as youmay realize my English also is not good :-(

Yes I did what ever you said on the link, and in the Details section I put
comboboxes for on those 2 columns. In the comboboxes I use that small
triangle shape on the left to use data bond items and it worked like I did
before with a hard code. But when I choose the add button from binding
nevigator and come to focus one of those comboboxes I can see all the data
that comes from my customer table. But when I click one of the customer name
it didn't move the focus it just stak in that comboboxes and I didn't get any
error so manualy I had to shut the application.

Display Member was the Customer Name and Value memeber was the customer ID
and selected value was CustomerID. But the focus it stack inside the
comboboxes and didn't move niether my keyboard or mouse. It happend
yestaerday as same with my hardcode before I post it my question.

So either I have to learn the Dutch in 1 day :) to read one of your article
again, or I have to ask you to translate them in English. Or before love to
ADO.NET 2.0 I have to jump from 6th floor.

I realy feel that ADO.NET 2.0 give us many good thing but I guess I start to
learn very early that there is not much article about VB.NET 2005 and
ADO.NET 2.0

So what should I do?

Cor, I realy very much appricated your kind response. Thank you very much.

Rgds,
GC
 
G

Guest

Hi Cor,

I forgot to mention that the error was:
"Relax or turn off constraints in your DataSets"
I felt human again when I see the word relax, I guess MS going to love me
more!!!

In the details section I use the BindingNavigator and move to from order to
and another and in one order I stop and try to check the comboboxes that
shows the CustomerID number and in DropDown was the Customer name. And when I
try to change it I get the above error. I hope this helps you that you can
help me more.

In previous version I use third party comboboxes and achive it by hard
coding style and if I am going to back that than whats the all the gimiks
that I am getting from ADO.NET 2.0.

I still feel that ADO.NET 2.0 is going to help me more but as you know me
all my previuos psot that I need to have it the answer one way or another but
there is not much article about it in English.

Thank you.

Rgds,
GC
 
E

Earl

You might want to check out David Sceppa's new book, Programming Microsoft
ADO.Net 2.0.
 
C

Cor Ligthert [MVP]

Niyazi,

In this text is use the Northwind dataset with orders and in a combobox
customers. Be aware that this is a small quickly translated part from an
article with a lot of images.

Comboboxen met relaties toevoegen in de DataGridView
Adding Comboboxen with relations in the DataGridView

We select the datagridview and select with a righ mouseclik "edit columns".
This can as well using the property window from a selected datagridview,
this is than in blue beneath the property box. We choose in the leftcolumn
"customer", see picture 8 (to big to send). After that we select at
columtype the DataGridViewCombobox. The propertytext becomes "Customer". As
next step we click on DataSource en choose (Be aware that this is the first
time confuising) "Other DataSources" en after that for NorthWindDataSet en
than Customers. There will be created automaticly again a
CustomerBindingSource. Now the displaymember can be changed. (this can only
if the previous step is done). We choose for CompanyNaem en after that we
choose in the same way at ValueMember for ConpanyId.

It is possible that there will be showed a page with all kinds of errors,
just closing the form in the designer and reopen it will solve this.

I hope that this is enoug to find your solution,

Cor
 
G

Guest

Hi,

Thank you Cor and Earl.
My problem was I had an customer like table with nearly 20 columns and it is
4 kind of customer. And as you know it was very difficult and time consuimg
to design the form layout for textboxes, labels etc.

So when I red more than 5 months about the VS.NET 2005 that I decided it
will going to help me much better way not for coding but simply will reduce
my design time.We actualy it did help both on that. All I do know is design
the form background and use designer to help me the connection to database.

Of course it has many new changes and it is getting much much better to code
since I start to coding in 1998 with VB 5.0.

The problem for me for the time and and to earn money wasn't always easy as
well as I want to create an application that will last long time and easy to
maintain when bussines logic will change and it seems the ADO.NET 2.0 is just
what I was looking for since 1998. The harder part was design I fed up to use
the get set property for each class that represent the data entry form.

I wanted to jump high but the design time always killed me and I couldn't
find any good companies to work with other programmers. So alone earn money
wasn't easy but I get great joy when I see someting getting much better.

Anyway I find some solution in dotnetmonster as:

CustomerComboBox.DataSource = CustomersBindingSource
CustomerComboBox.DisplayMember = "CustomerName"
CustomerComboBox.ValueMember = "Id" ' PK
CustomerComboBox.DataBindings.Add("SelectedValue", OrderBindingSource,
"CustomerId") ' FK

You don't need any other bindings for the ComboBox (eg. don't bind Text),
you can set this up using the designer too. If you aren't using any
BindingSource's then replace with the DataTable's or DataViews you're
using.

Also see:
http://msdn2.microsoft.com/en-us/library/3h6ac01k.aspx

Rgds,
GC
 
G

Guest

Hi Cor,

thank you very much for everyting in everytime helping me out.
It was very interesing and I choose to love the new ADO.NET 2.0

Simply its perfect I ever see any DB development enviroment.

If I ask to MS something for the next generation of .NET development do they
consider my input that useful?

Databinding the way that achived in ADO.NET 2.0 is very very good. Why they
don't work a just a bit and implement data value validation process inside
the databinding.

Example if the DB column has set to accept only int value and its len is
only 4 than in properties section for all the controlboxes specialy
textboxes, comboboxes and list that can add another properties that we can
easily assign the validation as:
Data len and data variable name, so in the text boxes I can choose the
validation propertis and I can enter variable type as int and its len as 4.

Sorry I am not saying anything negative just when I see how great with the
ADO.NET 2.0 (I guess is going to get us lazy writing a code) to design any DB
application so if they put that as well than I guess all we going to have
more fun.

The framework behind the databinding is there and it will be get much better
to implement similar frame work to validate the control that user going to
enter.

Or does there anything like that that I am not aware of?

Well it was very great to see ADO.NET 2.0

By the way COR, I can access the vb-tips in home easliy but I am having
difficulty to access from in my work because the networking guy use the
filters and accept the tips as tits and we are shout in the box. You should
consider to change the name similar to .greatvbnettips.com :)

Thank you for everythings.

Rgds,
GC
 
C

Cor Ligthert [MVP]

Niyazi,

Thanks for your tip about VB tips, I think that it is however impossible to
change that name.
There are to many names now used and there are to less names to keep in mind
what was the goal with this name. We just have to get rid of those System
Administrators with the knowledge of the previous century.

To give tips to Microsoft are the connect pages.

http://connect.microsoft.com/Main/content/content.aspx?ContentID=2220

Lot of succes,

Cor
 

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

Similar Threads


Top