Maybe I do not see obvious but I cannot overcome (simple I guess) problem.
Chapter "General Concepts in Database Application Development" documentation lists several advatages of typed MySqlDataSets over "The Standard Way" (DataSets)
Encoraged with nice features of MySqlDataSets compared to standard Dataset I played a bit with typed MySqlDatasets.
Using wizard I just select a table and put simple select string: "SELECT * FROM orders"
Wizard completes succesfully and typed dataset is created.
When I open it in editor I can see both:
i) data table ("orders")
ii) table adapter ("ordersTableAdapter")
Under table adapter I can see standard method Fill. Fine so far...
Then manually I try to add another select query to Table Adapter: "SELECT * FROM orders WHERE (id = :id)"
I enter the name of additional fill method: FillByID
All completes with no error.
I try to use this new MySqlDataset in the code.
In "The Standard Way" (DataSets) a/m fill methods were accessible as "Fill()" and "FillByID(int id)"
This is not however the case with MySqlDatasets...
I can see only (standartd) Fill() and Open() methods.
How can fill dataset with result of my paremetrised query: FillByID(int id) ?
Any hint will be appreciated.
Regards,
Wojtek
Strongly typed MySQLDataset - fill methods not available ?
-
- Posts: 729
- Joined: Thu 13 Dec 2007 10:24
For this purpose you need to create another MySqlDataAdapter, with a specific select string.
For example, I created a textBox for a needed rowId. I used test database with the dept table. This table is created and used by MyDirect demos. The select string is:
Here is a block of code you are interested in:
Probably you are searching for another method. Check if the RefreshRow(DataRow row) method from the DbDataTable class corresponds to your needs.
Additionally, you might grasp something interesting in this topic:
ms-help://CoreLab.MySql/MyDirect/DataTable.html
For example, I created a textBox for a needed rowId. I used test database with the dept table. This table is created and used by MyDirect demos. The select string is:
Code: Select all
select * from dept where(deptno = :deptno)
Code: Select all
int rowId;
int.TryParse(textBox1.Text,out rowId);
dataSet1.dept.SelectCommand.ParameterCheck = true;
dataSet1.dept.SelectCommand.Parameters.Add("deptno",rowId);
dataSet1.dept.Fill();
Additionally, you might grasp something interesting in this topic:
ms-help://CoreLab.MySql/MyDirect/DataTable.html