问题描述
是否有任何代码可以在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 +;
请帮助我,我不打算黑客攻击它我是一名新开发人员。谢谢
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
这篇关于如何以编程方式获取SQL Server的用户ID和密码。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!