Tag: mysql

在生产数据库上部署应用程序时无法加载文件或程序集’System.Data错误

问题:将我的应用程序部署到生产数据库时,出现以下错误: Could not load file or assembly ‘System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089’ or one of its dependencies. The system cannot find the file specified. at ConsoleApplication2.Database.DBConnect.Initialize(String username, String password, String IP) at ConsoleApplication2.Database.DBConnect..ctor(String username, String password, String IP) in C:\Users\Vincent\Documents\Visual Studio 2008\Projects\ConsoleApplication2\ConsoleApplication2\DBConnect.cs:line 26 at ConsoleApplication2.Database..ctor() in C:\Users\Vincent\Documents\Visual Studio 2008\Projects\ConsoleApplication2\ConsoleApplication2\Database.cs:line 20 at ConsoleApplication2.Main..ctor() in C:\Users\Vincent\Documents\Visual Studio 2008\Projects\ConsoleApplication2\ConsoleApplication2\Main.cs:line […]

使用MySql.Data.MySqlClient; 不管用

在我使用MS SQL之前,但在新项目中我使用mysql,当我运行我的应用程序时,我收到此错误 编译错误说明:在编译为此请求提供服务所需的资源期间发生错误。 请查看以下特定错误详细信息并相应地修改源代码。 编译器错误消息:CS0246:找不到类型或命名空间名称“MySql”(您是否缺少using指令或程序集引用?) 来源错误: Line 4: using System.Text; Line 5: using System.Web; Line 6: `using MySql.Data.MySqlClient; this namespace is not working Line 7: using System.Data.SqlTypes; 我怎么解决这个问题?

使用dapper.net返回mysql LAST_INSERT_ID()时无效的强制转换

MSSQL在这里已经涵盖了这个问题: 如何使用Dapper执行插入并返回插入的标识? 但是这个解决方案不适用于mysql。 要使用mysql将LAST_INSERT_ID()为整数,您必须这样做: SELECT CAST(LAST_INSERT_ID() AS UNSIGNED INTEGER); 堆栈跟踪是: Dapper.d__13`1.MoveNext() in sqlMapper.cs:607 System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) +159 System.Linq.Enumerable.ToList(IEnumerable`1 source) +36 Dapper.SqlMapper.Query(IDbConnection cnn, String sql, Object param, IDbTransaction transaction, Boolean buffered, Nullable`1 commandTimeout, Nullable`1 commandType) in sqlMapper.cs:535 有没有人在MySQL中解决这个问题? 编辑: 我已成功完成以下工作: var id = connection.Query(“SELECT CAST(LAST_INSERT_ID() AS UNSIGNED INTEGER);”).Single(); 也许并不理想,但它确实有效。

C# – 意外的身份validation方法mysql_native_passwordexception

我没有看到任何关于此的内容,但我一直在尝试用SQL数据库进行练习的最长时间。 我尝试过MSSQL并且感到很沮丧,所以我尝试了MySQL并且进一步了解了。 数据库似乎已启动并运行,我甚至进行了查询以创建表。 虽然在尝试连接Microsoft的C#Express版本时,我得到了例外:“意外的身份validation方法mysql_native_password”我知道密码是正确的。 我甚至引用了MySQL.Data.dll。 这是我的代码,我在connection.Open()上得到了例外。有人可以帮帮我吗? public Form1() { MySqlConnection connection = new MySqlConnection(“Data Source = localhost; Initial Catalog = MySQL55; Integrated Security = SSPI; User ID = root; Password = ;”); try { connection.Open(); } finally { if (connection != null) { connection.Close(); } } }

.NET CORE MySql MaxPoolSize未应用于

我们在RDS中托管了一个MySQl数据库。 创建MySQL连接时,似乎不应用最大池大小。 我们有一个看起来像这样的连接字符串 Server=myServer;Port=3306;Database=MyDatabase;User Id=MyUser;Password=MyPassword;ConnectionReset=True;pooling=true;minpoolsize=1;maxpoolsize=4;ConnectionLifeTime=30″ 我们在这里添加了最大池大小,但是我们的应用程序仍然保持着太多的连接。 我已经使用该命令在MySqlWorkbench中validation了这一点 select * FROM INFORMATION_SCHEMA.PROCESSLIST 我们正常地创建一个sql连接..我做错了什么? var connection = new MySql.Data.MySqlClient.MySqlConnection(_connectionString); connection.Open() 技术信息:MySql Server版本:5.7.16 MySqlConnector 🙁 Nuget Package) – > MySql.Data Version =“7.0.6-ir31” 更新: 在unit testing中执行此操作并并行打开MySQL连接时,一切似乎都很顺利。 但是,当Web请求通过ASP.NET Core进入时,似乎存在问题。

MySqlConnectionStringBuilder – 连接证书

我试图连接到Google Cloud Sql这是一个MySql解决方案。 我能够使用MySql Workbench进行连接。 如何使用MySqlConnectionStringBuilder在c#中连接? 我发现无法提供三个证书。

C#Mysql连接必须有效并且打开

首先:我在没有使用oop的情况下运行了代码。 我在同一个类中声明了所有变量,并在将查询传递给db之前和之后打开/关闭了连接。 那很有效! 现在有了一些新的经验,我试图将我的代码分成不同的类。 现在它不再工作了。 它告诉我“连接必须有效且开放”。 足够的文字,这是我目前的代码: Services.cs public static MySqlConnection conn // Returns the connection itself { get { MySqlConnection conn = new MySqlConnection(Services.ServerConnection); return conn; } } public static string ServerConnection // Returns the connectin-string { get { return String.Format(“Server={0};Port=XXXX;Database=xxx;Uid=xxx;password=xxXxxXxXxxXxxXX;”, key); } } public static void DB_Select(string s, params List[] lists) { try […]

如何使用其他Combobox填充Combobox?

我在这里有点新鲜,我对我正在制作的节目有很多疑问,但最让我烦恼的是标题上的节目。 基本上,我有一个Combobox,我用这个填充: DataSet ds = new DataSet(); MySqlDataAdapter da = new MySqlDataAdapter(“SELECT cveestado, nomestado FROM tbEstado”, conexion); da.Fill(ds, “FillDropDown”); cbEstado.DisplayMember = “Nomestado”; cbEstado.ValueMember = “CveEstado”; cbEstado.DataSource = ds.Tables[“FillDropDown”]; conexion.Close(); 根据用户选择的内容,我想根据第一个选择填充另一个combobox。 到目前为止,我有这个,但它不起作用: private void cbEstado_TextChanged(object sender, EventArgs e) { if (cbEstado.SelectedValue.ToString() == “Tabasco”) { try { DataSet ds = new DataSet(); MySqlDataAdapter da = new MySqlDataAdapter(“SELECT […]

身份(在数据库创建时)错误指定密钥太长

我在这里有AspNet Identity和MySql的问题,问题是错误,它真的阻止了我,这个错误如下: 指定密钥太长,最大密钥长度为767字节 现在我按照使用MySql和Identity的教程: http://www.asp.net/mvc/tutorials/security/aspnet-identity-using-mysql-storage-with-an-entityframework-mysql-provider 我想说我有进展,因为现在至少我得到了一些在MySQL中生成的表,但是我在这个问题上堆栈,很长一段时间我都试图解决这个问题,但没有成功。 我得到的错误在这部分: public void InitializeDatabase(ApplicationDbContext context) { if (!context.Database.Exists()) { // if database did not exist before – create it context.Database.Create(); } else { // query to check if MigrationHistory table is present in the database var migrationHistoryTableExists = ((IObjectContextAdapter)context).ObjectContext.ExecuteStoreQuery( string.Format( “SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = ‘{0}’ AND […]

在MVC3中使用ADO.NET MySQL提供程序(无法找到请求的.Net Framework数据提供程序。可能未安装。)

我试图连接到我的Web服务器上的mysql数据库,但我一直得到: Unable to find the requested .Net Framework Data Provider. It may not be installed. 我猜测ADO.NET连接器存在,因为如果我将配置更改为: providerName=”System.Data.SQLClient” 我明白了: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow […]