I followed the instructions here to try and call a (parameterless) MySQL SP from within a LightSwitch 2012 application. This cited instructions are for SQL Server SPs.
Here is the relevant code:
using System;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
namespace LightSwitchApplication
{
public partial class StoredProcceduresService
{
partial void MakeMasterOperations_Inserting(MakeMasterOperation entity)
{
using (SqlConnection connection = new SqlConnection())
{
string connectionStringName = this.DataWorkspace.SystemInfo.Details.Name;
connection.ConnectionString = ConfigurationManager.ConnectionStrings[connectionStringName].ConnectionString;
string storedProcedure = "make_master";
using (SqlCommand command = new SqlCommand(storedProcedure, connection))
{
command.CommandType = CommandType.StoredProcedure;
connection.Open();
command.ExecuteNonQuery();
}
}
this.Details.DiscardChanges();
}
}
}
This fails on connection.Open();
with a SqlException "Login failed for user 'root'." I know that userid and password are OK, since other database manipulations with the same connection string work just fine from within LightSwitch.
Is it possible to call MySQL SPs in LightSwitch? If so, how?