如何以编程方式获取SQL Server的用户ID和密码。 [英] How to get the User Id and Password of SQL Server programmatically.

查看:213
本文介绍了如何以编程方式获取SQL Server的用户ID和密码。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有任何代码可以在Windows窗体应用程序的textBox控件中检索SQL Server 2005的用户ID和密码?请提供代码来执行此操作。

我正在使用C#2.0和SQL Server 2005开发一个Windows窗体应用程序。在应用程序中我想在没有身份验证的表单的加载事件中建立连接或按钮控制,为此我写道如下: -



 string userid =    sa; 
string pass = md22mashkoor;
Class1.cs = 数据源= + System.Environment.MachineName + ;初始目录= Kolkata_Dental;用户ID = + userid + ; Password = + pass + ;
SqlConnection con = new SqlConnection();
con.ConnectionString = Class1.cs;
con。打开();
Class1.connection = true;



但此代码适用于具有特定用户ID或密码的特定服务器或计算机。我想要检索用户ID和密码的每个服务器或机器的代码,如Data Source =+ System.Environment.MachineName +;

请帮助我,我不打算黑客攻击它我是一名新开发人员。谢谢

解决方案

我确信你没有任何黑客攻击的意图,因为黑客真的需要了解内部,通常比开发商。



说实话,你只是在浪费精力。你所要求的是不可能的。



我建议你先去了解身份验证的工作原理。这是MSDN上的一个链接:



http://technet.microsoft.com/en-us/library/aa905171(v=sql.80).aspx

Is there any code to retrieve User ID and Password of SQL Server 2005 in a textBox control of Windows Form Application?? Please provide me code to do this.
I m developing a windows form application by using C#2.0 and SQL Server 2005. in the app I want establish a connection in the load event of form without an authentication or button control, for this I wrote like this:-

string userid = "sa";
string pass = "md22mashkoor";
Class1.cs = "Data Source= " + System.Environment.MachineName + ";Initial Catalog=Kolkata_Dental;User ID="+userid+";Password="+pass+"";
SqlConnection con = new SqlConnection();
con.ConnectionString = Class1.cs;
con.Open();
Class1.connection = true;


but this code works for a particular server or machine which has the particular User id or Password. I want code for every Server or machine which retrieve the User Id and Password like "Data Source= " + System.Environment.MachineName + ";
Please help me, I m not in intention of hacking it. I am a new developer. Thanks

解决方案

I am sure you do not have any intention of hacking as a hacker really needs to understand the internals, usually better than the developer.

On a serious note, you are just wasting you energy. What you are asking for is not possible.

I would suggest you to first go and understand how authentication works. Here is a link on MSDN:

http://technet.microsoft.com/en-us/library/aa905171(v=sql.80).aspx


这篇关于如何以编程方式获取SQL Server的用户ID和密码。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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