Master/Detail help

Master/Detail help

Postby Glyn » Thu 18 Aug 2005 18:48

I am new to MySqlDirect am trying create a simple master detail in a Visual Studio 2003 Web application.

I've used the code numerous times connecting to a MSDE database, but I'm strugling using MySQL and MySQLDirect.

I want populate a datalist on one page, then carry a value (selected choice) through the URL to another page and populate a datagrid based on the value passed over.

When debugging, the querystring value is passed over, but I get an error saying "Invalid index -1 for this Parameters"

Does a MySqlDataAdapter work in exactly the same way as an SqlDataAdapter?

Has anybody got any code samples?


I also wanted to populate a label with teh selected choice.
Part of the code was
"dtrMenu = MySqlCommand1.ExecuteReader"
But this gives an error saying,
"Value of type 'CoreLab.MySql.MySqlDataReader' cannot be converted to 'System.Data.SqlClient.SqlDataReader'."

Thanks
Glyn
 
Posts: 1
Joined: Thu 18 Aug 2005 18:28

Postby Serious » Fri 19 Aug 2005 06:56

When debugging, the querystring value is passed over, but I get an error saying "Invalid index -1 for this Parameters"
You use parameters in incorrect way.
To learn how to use them see 'Using Parameters' article.
"Value of type 'CoreLab.MySql.MySqlDataReader' cannot be converted to 'System.Data.SqlClient.SqlDataReader'."
Probably the type of dtrMenu is System.Data.SqlClient.SqlDataReader, this is not correct: use IDataReader or MySqlDataReader instead (see MySqlDataReader inheritance hierarchy).
Has anybody got any code samples?
You can find demo projects in the %ProgramFiles%\CoreLab\MySQLDirect.NET\Samples folder.
One more remark: converting projects that use SQL Server to projects that use MySQL (and MySQLDirect .NET) is not a good practice. Create a new project and use MySQLDirect .NET designers to avoid common errors.
Serious
 


Return to dotConnect for MySQL