From: Reggie Burnett Date: September 16 2004 5:14pm Subject: RE: Bug with parameters? List-Archive: http://lists.mysql.com/dotnet/3 Message-Id: <025401c49c10$afc660c0$0200a8c0@blackhole> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Someone didn't read the release announcement very closely. ;-) The syntax for setting parameters has changed. Now you use ? instead of @ to mark parameters. This change was necessary for proper compatibility with MySQL. However, realzing that people may have lots of code to change, I have included a connection string option that will enable the old syntax. Add "old syntax=yes" to your connection string and it will work. However, you should read the help on MySqlCommand. There is a note included that talks about the tradeoffs of doing this. -reggie -----Original Message----- From: David Anderson [mailto:david@stripped] Sent: Thursday, September 16, 2004 12:08 PM To: DotNet List Subject: Bug with parameters? I have the following bit of code which crashes with error "Column 'id' cannot be null" when run with the new connector, but the same thing works with the ByteFX . Is this a bug, or am I not calling parameters correctly? Regards David using System; using MySql.Data.MySqlClient; namespace mytest1 { /// /// Summary description for Class1. /// class Class1 { /// /// The main entry point for the application. /// [STAThread] static void Main(string[] args) { // Set up a mysql connection using MySql-AB string connstr = "Persist Security Info=False;database=pnet;server=benden;user id=dbuser;Password=p1nestap"; MySqlConnection conn = new MySqlConnection(connstr); MySqlCommand cmd = new MySqlCommand(); conn.ConnectionString = connstr; conn.Open(); string cmdstr = "insert into rawreviews (id, review) values(@id, @review)"; cmd.Connection = conn; cmd.CommandText = cmdstr; cmd.Parameters.Add("id", 4); cmd.Parameters.Add("review", "Fourth Review"); cmd.ExecuteNonQuery(); conn.Close(); } } } -- MySQL on .NET Mailing List For list archives: http://lists.mysql.com/dotnet To unsubscribe: http://lists.mysql.com/dotnet?unsub=reggie@stripped