List:MySQL and .NET« Previous MessageNext Message »
From:Reggie Burnett Date:November 18 2004 6:14pm
Subject:Re: Connector.NET 1.0.2 never returns a row
View as plain text  
Parameters are marked now with ?, not with @.  If you need to keep using 
the @, then you need to add "old syntax=yes" to your connection string.

-reggie

Klaus Prückl wrote:

>Hi,
>
>after the collation problems with Connector .NET 1.0.1 I'm still having trouble
> getting data from a 4.1.7 database (default charset: latin1) with version 1.0.2:
>
>My problem is, that I'm never getting a row (without errors). With ByteFX 0.76 the
> same source is working:
>
>string sql = "SELECT ID, Name, Password FROM Users WHERE Name = @Name AND Password =
> @Password";
>
>MySqlConnection connection = new MySqlConnection (
> "server=localhost;database=mydb;User Id=user;Password=xxxx" );
>connection.Open();
>
>IDbCommand command = connection.CreateCommand();
>command.CommandText = sql;
>command.CommandType = CommandType.Text;
>
>MySqlParameter p1 = new MySqlParameter();
>p1.DbType = DbType.String;
>p1.Direction = ParameterDirection.Input;
>p1.ParameterName = "@Name";
>p1.Size = 50;
>p1.Value = "username";
>command.Parameters.Add(p1);
>
>MySqlParameter p2 = new MySqlParameter();
>p2.DbType = DbType.String;
>p2.Direction = ParameterDirection.Input;
>p2.ParameterName = "@Password";
>p2.Size = 50;
>p2.Value = "MyPaSsWoRd";
>command.Parameters.Add(p2);
>
>IDataReader idr = command.ExecuteReader(CommandBehavior.CloseConnection);
>
>if( idr.Read() )
>{
>	...
>}
>
>I'm using the Data Access Application Block 3.1
> (http://www.gotdotnet.com/Workspaces/Workspace.aspx?id=c20d12b0-af52-402b-9b7c-aaeb21d1f431),
> so this is not 100% the code I'm having in use. I've just stepped through and copied all
> important commands out of it.
>
>
>Has anybody an idea what the problem could be?
>
>
>Thanks in advance!
>
>Klaus
>
>  
>
Thread
Connector.NET 1.0.2 never returns a rowKlaus Pr├╝ckl18 Nov
  • Re: Connector.NET 1.0.2 never returns a rowReggie Burnett18 Nov