我正在使用mysql在asp.net上工作。访问数据库时遇到一些异常(仅在生产环境中)
StackStrace-1:
at System.Threading.Thread.AbortInternal()
at System.Threading.Thread.Abort(Object stateInfo)
at System.Web.HttpResponse.AbortCurrentThread()
at Web_Report_ACKReport.ExportDataTableToCSV(DataTable dataTable)
StackStrace-2:
at MySql.Data.MySqlClient.NativeDriver.Ping()
at MySql.Data.MySqlClient.MySqlPool.GetPooledConnection()
at MySql.Data.MySqlClient.MySqlPool.TryToGetDriver()
at MySql.Data.MySqlClient.MySqlPool.GetConnection()
at MySql.Data.MySqlClient.MySqlConnection.Open()
at project.Data.ObjDIO.getDbConn(String connectionString)
at project.Data.AdoCompat.ConnectionObjects.OpenConnection()
at myProject.projName.DAL.DAL.Insert(String strFileName, Int32 totalRecords, Int32 insertedCount, Int32 queueId, Int32 reviewType, String strCreatedUser)
at BusinessLayer.Queue.QueueSupport.Create(String strFileName, Int32 totalRecords, Int32 insertedCount, Int32 queueId, Int32 reviewType, String strCreatedUser)
数据库连接字符串:
<add name="dbconnection" connectionString="server=dbserver; initial catalog=sampledv;user id=dbuser;password=dbpassword;pooling=true;" providerName="system.data.mysqlclient"/>
帮助我解决此问题。提前致谢。
最佳答案
您应该使用uid
而不是SQL查询字符串的用户ID
您的连接字符串看起来像
<add name="dbconnectionstring" connectionString="server=dbserver; initial catalog=sampledv;uid=dbuser;password=dbpassword;pooling=true;" providerName="system.data.mysqlclient"/>