ExecuteCommand on Entity

protected void Button2_Click(object sender, EventArgs e)
{
    Response.Write(Execute("SELECT NOW()"));
}

public string Execute(string storedProcedureName)
{
    using (EntityConnection connection = (EntityConnection)new EGModel.EGEntity().Connection)
    {
        using (EntityCommand command = connection.CreateCommand())
        {
            command.CommandType = CommandType.Text;
            command.CommandText = storedProcedureName;
            connection.Open();
            return command.ExecuteScalar().ToString();
        }
    }
}

I am getting error "The query syntax is not valid. Near line 1, column 13."; I am very curious, why this error? (Mysql Entity Connection)

Answers


    var A = new EGModel.EGEntity().Connection;

    var command = ((EntityConnection)(A)).StoreConnection.CreateCommand();
    command.CommandType = System.Data.CommandType.Text;
    command.CommandText = "SELECT NOW()";
    ((EntityConnection)(A)).StoreConnection.Open();
    string id = (string)command.ExecuteScalar();

@GTSouza Thank you for your comments,


Need Your Help

How to upload the default checkout procedure in magento

magento checkout

i am trying to fix a magento shop that another developer built.