连接到ADO.NET中的数据源 [英] Connecting to datasource in ADO.NET

查看:72
本文介绍了连接到ADO.NET中的数据源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么我们使用数据源配置向导"连接到数据源,然后再次使用连接字符串(在应用程序/程序内部)编写代码以连接到数据源.

Why do we use "Data Source Configuration Wizard" to connect to data source and then again write (inside the application/ program) the code using connection string to connect to data source.

推荐答案

向导"主要负责后台发生的Visual Studio魔术".
如果需要,它还将连接存储在配置文件中.

当您与数据库建立手动"连接时,您确实需要指定连接字符串.

否则,将在* .deisgner.cs文件中指定连接以及其他大多数魔术(数据集,视图和...).

我真的想尽可能地避免这种简单的情况,因为我喜欢控制自己的代码.
手动指定连接时,也更易于调试,记录....
The "Wizard" is mainly responsable for Visual Studio "magic" that goes on behind the scenes.
It also stores the connection in the config file if you want it to.

When you''re doing a "manually" connection to the db you do need to specify the conncetion string.

Else the connection is specified in the *.deisgner.cs file along with most of the other magic(datasets and views and...).

I really try to avoid it as much as possible for the simple fact that I like being in control of my code.
Also easier to debug, log... when manually specifiyng the connection.


这篇关于连接到ADO.NET中的数据源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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