Home > Net >  C # form to connect SQL server data
C # form to connect SQL server data

Time:11-25

C # to connect SQL server data according to have user login failure is how to return a responsibility, how be to return a responsibility? Is there a big help, on the Internet, I also tried it on the Internet, the method of no matter use,
System. The Data. SqlClient. SqlException: "users' his171201210 'login failed,"

CodePudding user response:

SQL server hybrid test
Set a sa password
The connection string in the user name sa, password set the password for you

CodePudding user response:

The problem of the database Settings?
Connect to the database code 1, suggest you to switch to the orm

CodePudding user response:

His171201210 user name rather than the database name is: are you sure?

CodePudding user response:

This is the code

The class DB
{
Private static readonly string connstring="server=DESKTOP - 38 ck79r; The database=his171201210; User=his; The PWD=123456 ";
Public static SqlConnection conn=new SqlConnection (connstring);
Public static void opendatabase ()
{
Try
{
Conn. The Open ();
}
The catch (Exception ex)
{
MessageBox. Show (ex. Message. The ToString ());
}
}
}

CodePudding user response:

On the first floor said method has already get the
I put my user name changed to ihs is still wrong, his171201210 is the database name,

CodePudding user response:

I get to get out again to the new problems, the database connection is not on, going away

CodePudding user response:

Could it be that doesn't suit the SQL server service

CodePudding user response:

With local visualization tools to see can even on first

CodePudding user response:

See if the database configuration tool, agent didn't open

CodePudding user response:

As a first step, using the database management tools you need to be able to log in, and you can keep track of your account and password, and you connect to the database instance name is usually the sa account, and install the database when you set the database sa password, original database instance can be used. Try,

Second, check your connection string, can go to baidu one,

CodePudding user response:

Authentication is essentially and Windows?
Is to use mixed authentication mode

CodePudding user response:

First of all determine whether the address and account password ok
Secondly confirm the server service is normal

  •  Tags:  
  • C #
  • Related