Note that there are some explanatory texts on larger screens.

plurals
  1. POmysql .net connector not working with a .net 4.0 project and connector 6.4.3 with sprocs
    text
    copied!<p>I had to rebuild a machine here and thought I'd just redo my web site in the process. I decided to go with mvc 3 but still use mysql on the back end.</p> <p>I essentially copied and pasted all of my old code for the sql connection to return results from a mysql stored procedure and it's not working at all. I then tried creating a simple insert sproc and it doesn't work either. If I use in-line sql on my MySqlCommand, it works fine however (both selecting and inserting). I'm thinking that with .net 4.0 they changed something on the CommandType.StoredProcedure...but I can't say for sure.</p> <p>When I put a breakpoint on my command call to the actual sproc, it doesn't show anything, nor does it actually do anything. I've called the sprocs from the CLI and they're working just as they should. Back to what I was saying, I'm guessing that with .net 4, it doesn't use the "Call" command any more. Anyone run into this issue? If so, do you have a solution? Is there anyway to import the System.Data 2.0 dll into a .net 4.0 project to verify what I'm thinking?</p> <p>here's some code on my database layer:</p> <pre><code>public static BuyCollectionModel GrabBuyData(GridSettings gridSettings) { int totalRows = 0; BuyCollectionModel buys = new BuyCollectionModel(); using (MySqlConnection myConnection = new MySqlConnection(AppConfig.Connection)) { //string sql = "SELECT 100 as totalrows, c.* FROM cBuys as c"; //MySqlCommand myCommand = new MySqlCommand(sql, myConnection); MySqlCommand myCommand = new MySqlCommand("usp_GetBuys", myConnection); myCommand.CommandType = CommandType.StoredProcedure; myCommand.Parameters.AddWithValue("@startrowvar", gridSettings.PageIndex); myCommand.Parameters.AddWithValue("@endrowvar", gridSettings.PageSize); myCommand.Parameters.AddWithValue("@sortcolvar", gridSettings.SortColumn); myCommand.Parameters.AddWithValue("@sortordervar", gridSettings.SortOrder); myConnection.Open(); using (MySqlDataReader myReader = myCommand.ExecuteReader()) { while (myReader.Read()) { buys.Add(FillBuys(myReader, out totalRows)); } } myConnection.Close(); } buys.TotalCount = totalRows; return buys; } </code></pre> <p>as mentioned above, I've also tried creating a simple insert sproc that works fine from the CLI, but when I call it from code using ExecuteNonQuery(), it does nothing...</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload