c#app连接到我的mysql服务器 [英] c# app connecting to my mysql server

查看:239
本文介绍了c#app连接到我的mysql服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我有一个问题,我正在尝试创建一个连接到我的mysql数据库的应用程序,但是我得到一个错误 - 后端发送无法识别的响应类型:8

如何解决这个问题?连接上弹出错误。打开行。



这里代码

-

Hello, I have a problem, i`m trying to make an application that connects to my mysql db, but i get an error-Backend sent unrecognized response type: 8
How to solve this? Error pops up on connection.Open line.

Here the code
-

NpgsqlConnection conection = new NpgsqlConnection("Server=xxx;Port=3306;Database=xxx;User Id=xxx;Password=xxx;");

NpgsqlDataAdapter npgsqldataadapteris1 = new NpgsqlDataAdapter();
conection.Open();

Npgsql.NpgsqlCommand komanda = new NpgsqlCommand("INSERT INTO tournaments(majaskomanda,viesukomanda,mgoli, vgoli) VALUES(@mvalsts,@vvalsts,@mgoli,@vgoli)", conection);
//komanda.Parameters.AddWithValue("match_id", comboBox2.Text);
komanda.Parameters.AddWithValue("mvalsts", richTextBox1);
komanda.Parameters.AddWithValue("vvalsts", richTextBox1);
komanda.Parameters.AddWithValue("mgoli", richTextBox1);
komanda.Parameters.AddWithValue("vgoli", richTextBox1);

komanda.ExecuteScalar();
conection.Close();
} 

推荐答案

您正在使用 postgres连接器 [ ^ ]连接到MySQL数据库。



MySql Connector下载。 [ ^ ]是您需要与MySql一起使用的连接器
You are using a postgres connector[^] to connect to a MySQL database.

MySql Connector downloads.[^] is the connector that you need to use with MySql


你好,



NpgsqlConnection Class表示与 PostgreSQL的连接服务器。你为什么用它来连接 MySQL 。您应该使用适用于MySQL(Connector / NET)的ADO.NET驱动程序此处



问候
Hello,

NpgsqlConnection Class represents a connection to a PostgreSQL server. Why are you using it to connect to MySQL. You should be using ADO.NET Driver for MySQL (Connector/NET) available here.

Regards


这篇关于c#app连接到我的mysql服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆