使用mysql服务器数据库在WPF数据网格控件中进行数据绑定 [英] Data binding in WPF datagrid control using mysql server database

查看:79
本文介绍了使用mysql服务器数据库在WPF数据网格控件中进行数据绑定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将数据表从MySQL导入到datagrid wpf。



但错误('空引用异常未被用户代码'对象引用处理未设置为对象的实例。'Pin )显示此行代码:



I'm trying to import datatable from MySQL to datagrid wpf .

But error ('Null Reference exception was unhandled by user code 'Object reference not set to an instance of an object.' Pin) shows at this line code :

string ConString = ConfigurationManager.ConnectionStrings["ConString"].ConnectionString;







我认为这是一个配置问题,但我的连接信息是正确的!



我尝试过:



我按照本文中的步骤操作:< br $> b $ b

www.codeproject.com/Tips/362436/Data-binding-in-WPFquestsGrid-control?msg=5389895#xx5389895xx



这是我的APP.config






I think it's a configuration problem , but my connection information are correct !

What I have tried:

I followed the steps in this article :

www.codeproject.com/Tips/362436/Data-binding-in-WPF-DataGrid-control?msg=5389895#xx5389895xx

and this is my APP.config

<?xml version="1.0" encoding="utf-8" ?>

<configuration>

    <connectionStrings>
      <add connectionString ="SERVER=; DATABASE=; UID=; PASSWORD= ;" name="ConString"/>
    </connectionStrings>

</configuration>



我是初学者在WPF中,感谢您的帮助:)抱歉我的英语不好。


I'm a beginner In WPF ,Thank you for any help :) Sorry for my bad English .

推荐答案

发布解决方案以关闭帖子.OP已确认问题已解决.App.config的第二个副本导致问题。
Posting solution to close off post. OP has confirmed that the problem is resolved. A second copy of App.config was causing the problem.


这篇关于使用mysql服务器数据库在WPF数据网格控件中进行数据绑定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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