system.data.dll中发生了'system.argumentexception'类型的未处理异常 [英] An unhandled exception of type 'system.argumentexception' occurred in system.data.dll
本文介绍了system.data.dll中发生了'system.argumentexception'类型的未处理异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试为我的c#项目构建一个sql数据库用户名和密码,但是当我尝试运行它时,它说
System.Data中发生了一个未处理的类型'System.ArgumentException'异常。 dll
这是我的代码
MySqlConnection con = new MySqlConnection(@Data Source = localhost; port3306; Inital Catalog = id412964_loginl33t; User Id = root; password ='');
它说;不是支持,但它适用于视频教程。
我尝试过:
我试图带走;但它给了我一个错误所以我需要;
解决方案
看起来端口属性中有一个拼写错误,它应该是port3306< pre lang =c#> Port = 3306
您可以查看以下链接以获取现成的连接字符串:
MySQL连接字符串 - ConnectionStrings.com [ ^ ]
I am trying to build a sql database username and password for my c# project but when I try to run it, it says
An unhandled exception of type 'System.ArgumentException' occurred in System.Data.dll
here is my code
MySqlConnection con = new MySqlConnection(@"Data Source =localhost;port3306;Inital Catalog=id412964_loginl33t;User Id=root;password= ''");
it says the ; is not support but it worked on the tutorial for the video.
What I have tried:
I have tried to take away the ; but it gives me a error so I require the ;
解决方案
Looks like there is a typo in port property, it should beport3306Port=3306
You can check the below link for readymade connections strings:
MySQL connection strings - ConnectionStrings.com[^]
这篇关于system.data.dll中发生了'system.argumentexception'类型的未处理异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文