none
mysql command errors - need help RRS feed

  • Question

  • Code Snippet

                            string connectionString = "datasource=xxx;username=xxx;password=xxx;database=xxx";
                MySqlConnection mySqlConnection = new MySqlConnection(connectionString);

                string selectString =
                "SELECT username, password " +
                "FROM forum_members " +
                "WHERE username = '" + frmUsername.Text + "' AND password = '" + frmPassword.Text + "'";

                MySqlCommand mySqlCommand = new MySqlCommand(selectString, mySqlConnection);
                mySqlConnection.Open();
                String strResult = String.Empty;
                strResult = (String)mySqlCommand.ExecuteScalar();
                mySqlConnection.Close();

       
    The underlined commands are giving me errors, how can I fix it? I need to use mySql not MSsql. Any help?

    thanks      
    Tuesday, April 8, 2008 11:04 PM

All replies

  •  J0S3 wrote:
    Code Snippet

                            string connectionString = "datasource=xxx;username=xxx;password=xxx;database=xxx";
                MySqlConnection mySqlConnection = new MySqlConnection(connectionString);

                string selectString =
                "SELECT username, password " +
                "FROM forum_members " +
                "WHERE username = '" + frmUsername.Text + "' AND password = '" + frmPassword.Text + "'";

                MySqlCommand mySqlCommand = new MySqlCommand(selectString, mySqlConnection);
                mySqlConnection.Open();
                String strResult = String.Empty;
                strResult = (String)mySqlCommand.ExecuteScalar();
                mySqlConnection.Close();

       
    The underlined commands are giving me errors, how can I fix it? I need to use mySql not MSsql. Any help?

    thanks      

    Post the error messages.

    Tuesday, April 8, 2008 11:35 PM
  •  

    The type or namespace name 'mysqlcommand' could not be found(are you missing a using directive or an assembly reference?)

     

     

    The type or namespace name 'mysqlconnection' could not be found(are you missing a using directive or an assembly reference?)

    Wednesday, April 9, 2008 12:12 AM
  • You will need to add mysql provider for ado.net to the list of references. You can download ado.net mysql provider from mysql's website.
    Wednesday, April 9, 2008 10:25 AM
  •  Giorgi Dalakishvili wrote:
    You will need to add mysql provider for ado.net to the list of references. You can download ado.net mysql provider from mysql's website.

     

    http://dev.mysql.com/downloads/

    Wednesday, April 9, 2008 1:36 PM