如何调用.net系统中的数据库连接属性对话框?

dgh_85 2006-08-05 07:57:34
为了想让客户自己配置数据库连接,如何调用.net系统中的连接属性对话框?
谢谢了!
...全文
377 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
yzg100 2006-12-04
  • 打赏
  • 举报
回复
Reference ADODB in your project. This is required to read the COM object passed back from DataLinks. This file is located here: c:\Program Files\Microsoft.NET\Primary Interop Assemblies\adodb.dll

Reference DataLinks in your project. DataLinks used to be MSDASC.dll, but has changed to OLEDB32.DLL (see KB). This file is located here: C:\Program Files\Common Files\System\Ole DB\OLEDB32.DLL


private void ButtonGetConnectionString_Click(object sender,
System.EventArgs e)
{
/*
Reference DataLinks
NOTE: Reference
C:\Program Files\Common Files\System\Ole DB\OLEDB32.DLL
(Was MSDASC.dll)
SEE:
http://support.microsoft.com:80/support/kb/articles/Q225/1/32.asp
*/
MSDASC.DataLinks dataLinks = new MSDASC.DataLinksClass();
//note that a reference to:
// c:\Program Files\Microsoft.NET\Primary Interop Assemblies\adodb.dll
//is also required to read the ADODB._Connection result
ADODB._Connection connection;
//are we editing an existing connect string or getting a new one?
if(this.txtConnectionString.Text==String.Empty)
{
// get a new connection string
try
{
//Prompt user for new connect string
connection = (ADODB._Connection)dataLinks.PromptNew();
//read result
this.txtConnectionString.Text=
connection.ConnectionString.ToString();
}
catch(Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
else
{
// edit connection string
connection=new ADODB.ConnectionClass();
connection.ConnectionString=this.txtConnectionString.Text;
//set local COM compatible data type
object oConnection=connection;
try
{
//prompt user to edit the given connect string
if((bool)dataLinks.PromptEdit(ref oConnection))
{
this.txtConnectionString.Text=
connection.ConnectionString;
}
}
catch(Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
}
wls12342004 2006-08-11
  • 打赏
  • 举报
回复
自己写个对话框模拟就可以了呀,做个简单点的还是可以的
yooxee 2006-08-11
  • 打赏
  • 举报
回复
不明白,直接给让客户传递过来值,在SERVER组成数据库连接字符串不就行拉?
kingtoo008 2006-08-10
  • 打赏
  • 举报
回复
路过...
------------------------------------------------------------------------------------
100M.Net空间+50M企业邮局=60元/年
100M.Net空间+国际顶级域名=100元/年
国际顶级域名.com.net.cn=50元/年
本站申请域名可绑定免费10M Asp.Net空间
1000M.Net空间 + 100M MsSql数据库 + 1000M企业邮局 + 顶级域名=600元/年
数据库 企业邮局 网站推广 整机租用 美国空间 网站建设 均有售
还有很多优惠套餐提供给各个用户层.
有意者可联系电话:021-64802212 传真:021-64802212
咨询信箱:info@kingtoo.com 咨询OICQ:68311305,379620139 81778640
dgh_85 2006-08-10
  • 打赏
  • 举报
回复
MSDASC这个命名空间从什么地方可以找到啊!
周盖文 2006-08-10
  • 打赏
  • 举报
回复
做个输入连接字符串的页面就行了啊
Teng_s2000 2006-08-09
  • 打赏
  • 举报
回复
这么多引用啊
superb 2006-08-07
  • 打赏
  • 举报
回复
using MSDASC;
using Microsoft.Win32;
using ADODB;


MSDASC.DataLinks _dataLinks= new MSDASC.DataLinksClass();
ADODB.Connection _connection=new ADODB.ConnectionClass();
object obj = _connection as object;
bool dialogresult=_dataLinks.PromptEdit(ref obj);

试试,是不是要这个!
dgh_85 2006-08-05
  • 打赏
  • 举报
回复
当点击sqlConnection 对象当中的connectionstring的属性时,不是会弹出数据连接属性对话框吗?有提供程序选项卡,可在提供程序中选择你所连接的数据库,还有连接选项卡,可在连接中设置连接数据库相关属性设置。
gkl0818 2006-08-05
  • 打赏
  • 举报
回复
不懂你在说什么,具体一点

17,740

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 .NET Framework
社区管理员
  • .NET Framework社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧