Does anyone call stored procedure successfully in MS dotnet platform?
Posted by: Owen Ni
Date: November 15, 2004 06:52PM

Hi everyone,
My working environment is MySql 5.0.1-alpha-max, VB.Net 2003 and Windows 2000 Professional. I need to call the stored procedure in the VB.Net program. The stored procedure has been tested in the mysql command console. It works fine.

When I use the mysql-connector-net-1.0.1-beta to call the stored procedure, I get "Exception trying to retrieve parameter info for GetAllUser: #HY000Illegal mix of collations(latin1_bin,IMPLICIT) and (utf8_general_ci, COERCIBLE) for operation '='" error message. The test code is
Try
Dim oMySqlDA As MySqlDataAdapter = New MySqlDataAdapter
Dim oMySqlCmd As MySqlCommand
Dim oDS As DataSet = New DataSet
Dim oMySqlConn As MySqlConnection
Dim oRow As DataRow
oMySqlConn = New MySqlConnection
oMySqlConn.ConnectionString = "Password=;User ID=root;Initial Catalog=TestDB;Data Source=localhost"
oMySqlConn.Open()
oMySqlCmd = New MySqlCommand("GetAllUser", oMySqlConn)
oMySqlCmd.CommandType = CommandType.StoredProcedure
oMySqlDA.SelectCommand = oMySqlCmd
oMySqlDA.Fill(oDS)
Catch ex As Exception
MsgBox(ex.Message)
End Try
The DEFAULT CHARACTER SET for the database and all tables are utf8.

The strange thing is if I pass a no exit stored procedure name (e.g. fakeSP) to the test program, I get the almost some error as follows:
"Exception trying to retrieve parameter info for fakeSP: #HY000Illegal mix of collations(latin1_bin,IMPLICIT) and (utf8_general_ci, COERCIBLE) for operation '='". But when I use direct SQL SELECT statement instead of stored procedure, it works fine.

I also tried to use ODBC (MyODBC-standard-3.51.9-win driver) to call the stored procedure, I get
"ERROR [42000] [MySQL][ODBC 3.51 Driver][mysqld-5.0.1-alpha-max]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'GetAllUser' at line 1" error message. The test code for using ODBC is
Try
Dim oOdbcDA As OdbcDataAdapter = New OdbcDataAdapter
Dim oOdbcCmd As OdbcCommand
Dim oDS As DataSet = New DataSet
Dim oRow As DataRow
oOdbcConn = New OdbcConnection
oOdbcConn.ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};SERVER=localhost;DATABASE=TestDB;USER=root;PASSWORD=;OPTION=3"
oOdbcConn.Open()
oOdbcCmd = New OdbcCommand("GetAllUser", oOdbcConn)
oOdbcCmd.CommandType = CommandType.StoredProcedure
oOdbcDA.SelectCommand = oOdbcCmd
oOdbcDA.Fill(oDS)
Catch ex As Exception
MsgBox(ex.Message)
End Try

I don't know whether the calling stored procedure is not implemented in the dotnet environment in the current latest version or I did something wrong. I am very appreciating, if anyone can point out what I did wrong. If anyone ever call the stored procedure successfully (no meter is VB.Net, C# or other language), please tell me what did you do (a small sample code is the best).

Thanks,

Owen Ni

Options: ReplyQuote




Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.