Textbox Acting Strange

abhi2823

Active member
Joined
Sep 8, 2007
Messages
32
Programming Experience
1-3
Hi there
I have created a dataset which only has one table and made 6 dataadapters out of it.
Now I am adding data to the table in my database through a different form.
In a report kind of form I am using the dataset and data adapters.
I have connected one data adapter to the combo box for dates,the second one for party name and the third is connected to the text box for rates, So the idea is when I choose a date from the first combo box the parties on that particular date is going to come in the second combo box and when i select the party in the secnd combo box the rates of that parties is going to be displayed.
All the things are happening but the problem looks like that the rates data is struck somewhere and it is only showing me the rates which i have entered first.
for eg. on 1/1/2008 i have entered 900 for xyz and on 2/1/2008 i have entered 990 for xyz but the text box is showing 900 even when the date selected is 2/1/2008 and the party is xyz. the data is there in the database.

I am using mysql as a database
 
you need to have the your dataAdapters related, and from each related table pull the correct info...

so...

LOAD Dates (from table1)

SELECT Parties that are only available for those dates (from table2)

SELECT Rate(s) for that party (from table3).


It might be better if you can post some more info - as in what columns are in your table and what exactly your 6 adapters are and what SQL they are using...
 
Sorry for not being clear.

Ok
The adapters are linked with each other in realtionshiop one to many and are related to only one table
adapter 1 sql is select dates from table where type = 'oil seed' ->combo box
adapter 2 sql is select dates,firm from table where type ='oil seed'->combo box
adapter 3 sql is select firm,rates from table->text box the problem area the rates are always the same

the relation is dates and dates, firm and firm

adapter 4 sql is select dates from table where type = 'oil cake' -> combo box
adapter 5 sql is select dates,firm from table where type ='oil cake'-> combo box
adapter 3 sql is select firm,rates from table-> text box the problem area the rates are always the same
the relation is dates and dates, firm and firm


I hope this helps
 
I guess my first question is why you have six different adapters.
You could have one adapter with six different queries.
Each adapter has its own overhead to deal with, making the connection to the Db, etc.
Working with MySql a lot, I like to build my own adapters that use a datareader. I only use the datasets for strong typing the schema.

But more to your point. You should make sure that the textbox (databound right?) is getting updated when the combo box changes. To double check that you might want to add a button "GO" or something to that effect, just to make sure. Another thing that helps me sometimes is to prevew data, to make sure its returning what you'd expect. I also use the MySql query browser for this as well.

One thing also to make sure. I use the v1.4 Connector/Net. This doesn't seem to add update and delete command to the adapters. If your logic relys on this make sure you create those.

Hope this helps.
 
OK, lets see if we can make this a little simpler.
Basically you wish for a textbox to be updated based on two seperate parameters?

Your table:
CREATE TABLE `myDatabase`.`myTable` (
`Col1` varchar(45) NOT NULL,
`Col2` varchar(45) NOT NULL,
`Col3` int(10) NOT NULL,
PRIMARY KEY (`Col1`,`Col2`))

You fill two combo boxes with Col1 and Col2.
Textbox is a result of your query:
Select Col3 FROM `myTable` WHERE `Col1` = ?Combo1 AND `Col2` = ?Combo2;

I hope I'm getting the general idea here. :)

Your saying when you change either col1 or col2, the textbox doesn't update.
You need to make sure that when your combo boxes change value that the textbox gets invalidated. If your manually filling the textbox, then handle an event off the combo box ("SelectedIndexChanged" should be ok) and update your textbox in there. If your binding the textbox, (I think) you'll still have to handle these events, then just do a .databind() on the textbox to invalidate it.

Let me know if this works out for you.

Cheers.
 
Ok,
So your textbox is not databound.
In order for it to update with the correct values you'll have to update it programatically using events from the drop downs.

I'm still not sure about how your form is setup. If the above doesn't work then I'll have to know about how you get the inital values into the controls.

Cheers.
 
so it is going to be how
something like this
textbox1.text=Select Col3 FROM `myTable` WHERE `Col1` = ?Combo1 AND `Col2` = ?Combo2;
i tried it but it is not working or may be i am doing it wrong
 
Back
Top