gpt4 book ai didi

c# - 尝试使用 root 以外的用户访问 MySQL 数据库时,ASP.NET Web 应用程序抛出异常

转载 作者:行者123 更新时间:2023-11-29 22:54:11 25 4
gpt4 key购买 nike

我试图避免使用 root 用户作为在 ASP.NET Web 应用程序中访问 MySQL 数据库的用户。这是我的连接字符串:

<add name="MyConnectionString" providerName="MySql.Data.MySqlClient" connectionString="Data Source=90.232.111.231;Initial Catalog=mydb;User ID=root;Password=rootpassword;Convert Zero Datetime=True"/>

应用程序在使用该连接字符串时不会出现任何问题。但是,当我将连接字符串更改为:

<add name="MyConnectionString" providerName="MySql.Data.MySqlClient" connectionString="Data Source=90.232.111.231;Initial Catalog=mydb;User ID=myuser;Password=mypassword;Convert Zero Datetime=True"/>

我收到以下异常:

Parameter 'eturnValue' not found in the collection.
Exception Details: System.ArgumentException: Parameter 'eturnValue' not found in the collection.

这是在第一次尝试访问数据库时登录时出现的。

我不知道 eturnValue 来自哪里,因为运行之间的唯一区别是我尝试使用哪个用户访问数据库。我确认我的 mysql 用户已正确设置,它拥有 root 帐户的所有权限,至少我的主机支持人员是这么告诉我的。

我正在通过 C# 中的 MySql 对象调用存储过程。

最佳答案

某些东西正在尝试迭代集合中的项目(大概它会寻找“ReturnValue”),但在某处它已被键入为“eturnValue”,因此无法找到它。

由于我无法从您的异常详细信息中看出它来自何处,因此您应该对“eturnValue”执行“在文件中查找” - 您可能会发现代码中存在拼写错误。或者检查数据库中的存储过程是否相同。

关于c# - 尝试使用 root 以外的用户访问 MySQL 数据库时,ASP.NET Web 应用程序抛出异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28788648/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com