using (var conn = DataFactory.InitializeConnection(false)) { conn.query("Procedurename",new { puserID = ID },commandType: System.Data.CommandType.StoredProcedure); }
DataFactory是以下静态类:
public static class DataFactory{ public static IDbConnection InitializeConnection(bool open = true,string connectionstring = "",string databaseServerType = "MysqL") { if (string.Equals(databaseServerType,"MysqL")) { if (string.IsNullOrEmpty(connectionstring)) connectionstring = Settings.Default.DataConnectionString; var csb = new mysql.data.MysqLClIEnt.MysqLConnectionStringBuilder(connectionstring); var conn = new mysql.data.MysqLClIEnt.MysqLConnection(csb.ConnectionString); Dapper.DefaultTypeMap.MatchnamesWithUnderscores = true; if (open) conn.open(); return conn; } throw new NotImplementedException("Not implemented for your database provIDer"); }}
我的数据库中没有bogus_table,它显示在错误消息中:
解决方法 这可能是 Mysql Driver实施中的问题;这里是提到 bogus_table的代码块.mysql.data.MysqLClIEnt.MysqLException (0x80004005): SELECT command
denIEd to user ‘XXX’@’YYY’ for table ‘bogus_table’ at
mysql.data.MysqLClIEnt.MysqLStream.ReadPacket() at
mysql.data.MysqLClIEnt.NativeDriver.GetResult(Int32& affectedRow,
Int64& insertedID) at
mysql.data.MysqLClIEnt.Driver.NextResult(Int32 statementID,Boolean
force) at mysql.data.MysqLClIEnt.MysqLDataReader.NextResult() at
mysql.data.MysqLClIEnt.MysqLCommand.ExecuteReader(CommandBehavior
behavior) at mysql.data.MysqLClIEnt.MysqLDataReader.ClearKillFlag()
at mysql.data.MysqLClIEnt.MysqLDataReader.Close() at
mysql.data.MysqLClIEnt.MysqLDataReader.dispose(Boolean disposing)
at mysql.data.MysqLClIEnt.MysqLDataReader.dispose() at
Dapper.sqlMapper.d__1361.<>m__Finally1() at
1.MoveNext()
Dapper.sqlMapper.<queryImpl>d__136
如果你的过程有空结果,尝试用Execute调用(因为它实现了内部执行非查询)而不是query.
using (var conn = DataFactory.InitializeConnection(false)) { conn.Execute("Procedurename",commandType: System.Data.CommandType.StoredProcedure); }总结
以上是内存溢出为你收集整理的c# – MySql.Data.MySqlClient.MySqlException(0x80004005):SELECT命令被拒绝用户’XXX’@’YYY’用于表’bogus_table’全部内容,希望文章能够帮你解决c# – MySql.Data.MySqlClient.MySqlException(0x80004005):SELECT命令被拒绝用户’XXX’@’YYY’用于表’bogus_table’所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)