Error previewing data with GetData(parameter) of TableAdapter

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for MySQL
Post Reply
griff
Posts: 2
Joined: Thu 28 Feb 2008 18:05

Error previewing data with GetData(parameter) of TableAdapter

Post by griff » Thu 28 Feb 2008 18:54

When I add a parameter "currencyId" to a TableAdapter and try to preview data I get the error: "Fill,GetData(currencyId) could not be previewed. ‘currencyId’ parameter is missing at the statement"

I am using Core Lab MyDirect .NET 4.30.24.0 and Core Lab MyDeveloper Tools with MySQL Server 5.1.

Has anyone encountered this? Thanks.


Here are the details.

I have this table in MySQL called "currency":

CREATE TABLE `optionstraderii`.`currency` (
`id` char(3) NOT NULL,
`name` varchar(50) NOT NULL,
PRIMARY KEY (`id`)
);

I created a TableAdapter for the currency table. I did this by right clicking on the designer page and choosing "Add>Table Adapter…" The TableAdapter is called "currency1TableAdapter" and the DataTable is called "currency1DataTable".

In the QueryBuilder, I set the filter for the id row to "= currencyId". The query is: SELECT id, name
FROM currency WHERE (id = 'currencyId').

I want to change the currency1DataTable.GetData() method to take a string as a parameter. I right click on the TableAdapter in the designer and choose Properties. In the dialog box that appears, I click on the "…" button to the right of the Parameters label.

In the "Parameters Collection Editor" I add a parameter by clicking on the Add button. I chose "Char" from the "ProviderType" drop down menu. I set Size to 3. I set the SourceColumn to id. I set the ParameterName to "currencyId".

In the designer, the currency1 TableAdapter displays the GetData(currencyId) method.

I right click on the currency1 TableAdapter and choose "Preview Data…" The Preview Data dialog box appears. I enter a parameter in to the currencyId row and click the Preview button. I get the error ""Fill,GetData(currencyId) could not be previewed. ‘currencyId’ parameter is missing at the statement""

I tried changing the parameter name to "@currencyId" but the error is the same.

Alexey.mdr
Posts: 729
Joined: Thu 13 Dec 2007 10:24

Post by Alexey.mdr » Fri 29 Feb 2008 13:08

Please create a new TableAdapter (like you did before).
In the QueryBuilder, set the filter for the id row to ":currencyId".
The query is: SELECT id, name FROM currency WHERE (id = :currencyId).
Proceed till the wizard finishes.
Now you will be able to preview data.
The parameters are regenerated automatically.

P.S. you didn't specify the parameter in the SELECT string.
See the difference:

Code: Select all

SELECT id, name FROM currency WHERE (id = 'currencyId')
SELECT id, name FROM currency WHERE (id = :currencyId)

Post Reply