473,320 Members | 1,930 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Sql select problem ( data fill)

HI...

I have 2 tables, one for the countries and another for the states, and I
make a fk in the states tables that connect it to the countries table.

But now I want to make a dropdownlist with the countries, and when the
user select the country a listbox will be filled with the states. But
how can I do that??? Is that a way to so a select string int the
dataset??? or I'll need to make another data adapter and make a select
to the database itself???

thx...

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 16 '05 #1
2 1753
Hi Ricardo
One thing that you can do is to bind the second combo box ( the one with
the child relation " the state " to a DataView . on that dataview do a
RowFilter on the country name ( depending on the country name displayed on
the first combo box . once the user change that country name , change the
filter to the new country name so that the rows that are available on the
view are only those that are in the new displayed country .
You would have some code like that
private void Country_SelectedIndexChanged(object sender,
System.EventArgs e)
{
dataView_CityRowFilter="countryId="+country.Select edValue;
}

Mohamed M .Mahfouz
Developer Support Engineer
ITWorx on behalf of Microsoft EMEA GTSC

Nov 16 '05 #2
Hi Ricardo,

I don't know all your DB philosophy, but i can recommend to
use DataView with RowFilter...

dataView1.Table = dataTableAllStates;
If nothing is selected them set
dataView1.RowFilter=String.Empty;
elswere set it as e.g.
dataView1.RowFilter=String.Format("[COUNTRY_NAME]=\'{0}\'"
, comboBox1.SelectedValue);

HTH
Marcin
HI...

I have 2 tables, one for the countries and another for the states, and I
make a fk in the states tables that connect it to the countries table.

But now I want to make a dropdownlist with the countries, and when the
user select the country a listbox will be filled with the states. But
how can I do that??? Is that a way to so a select string int the
dataset??? or I'll need to make another data adapter and make a select
to the database itself???

thx...

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Newman | last post by:
Hello all I need help with a script. What I want to do is to select data from a sql database and then create a text file of that data. For example 'elect * from customers where code = misc' ...
5
by: Han Lim | last post by:
Dear All, I have an application written by VB.Net with connect to a Microsoft Access database. One of the forms is to select data using oleAdapter and fill it into a dataset. In the oleAdapter, i...
2
by: nikou_70 | last post by:
Hi guys, I write a program with asp that select data from data base and show data in text box in asp, I want to know how user can change data and save it in this page, (I want to view and save data...
10
by: bsn | last post by:
Hello NG I want to select data from another DB, and use this data in currentDB. I have this SQL in a VBA procedure: Sql = "SELECT * FROM Firma " It is not working Any suggestions... ...
1
by: Sharon | last post by:
hello Everyone, Is it possible to select data from the datagrid, i have a populated datagrid with three columns FirstName, LastName, Email. When the user selects one row i want the values of the...
0
by: crbaker | last post by:
I have installed the Oracle Client on a Windows 2003 Server and have connected to Oracle using ODBC. I have a UDB/DB2 V8.1 database on the Windows 2003 Server and would like to select data from a...
0
by: Lisa Coal | last post by:
I am using the Insert database command several times in a visual basic macro. Every time I use the command in the macro the Select Data Source screen appears even though the source is set in the...
11
by: cooperkuo | last post by:
Dear all, I have a question about ADO in the subform. I know how to use ADO to insert/update/select data into the sigin form, but wehn I try to do it in the form with subform((Datasheet). I don't...
1
by: =?Utf-8?B?RnJhbmsgVXJheQ==?= | last post by:
Hi all I have a DataSet with 2 tables. Now I want to select data like a INNER JOIN from these tables. In SQL Syntax I would write: SELECT * FROM table1 t1 INNER JOIN table2 t2 ON t1.f1 =...
1
by: sajjad525 | last post by:
php-mysql, how we can select data from multiple table please any one help me about the query which will be used to select data from mutiple table suppose if i have 3 table name like t1,t2,t3...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.