Platform: XP3 + Vs 2008 Professional Edition, dedicated to SQL Server Management Studio Express.
At present, I do not know the difference between windows verification and SQL verification during login.
After the table is created, select SQL verification. First, change the security of the table attributes to the SQL and windows hybrid modes.
Create a new user in the login name and remove the forced password expiration.
// Call the real-time window during project debugging.
Public partial class Register: System. Web. UI. Page
{
Protected void Page_Load (object sender, EventArgs e)
{
}
Public void getData ()
{
SqlConnection cn = new SqlConnection (@ "server = 047 \ SQLEXPRESS; database = sky9Data; user = safari; password = 123 ");
SqlCommand cmd = new SqlCommand ("select * from UserID", cn );
SqlDataAdapter da = new SqlDataAdapter (cmd );
DataSet myRun = new DataSet ();
Da. Fill (myRun, "UserID ");
}
Protected void Button1_Click1 (object sender, EventArgs e)
{
GetData ();
}
}
}
// The following is the conversion.
A new database was created in the test web project today, and an error was returned. In the past, I used to log on directly and select 'windows Authentication'. There was no problem! You can use 'sqlserver Authentication' to log on some time ago, and the problem arises. No matter what method is used, it is a result error! The cause of the error is: 'user 'sa 'Logon Failed. This user is not associated with a trusted SQL Server connection. I have been online for a long time today, but I am still not sure about it. I finally got it done through the summary on the Internet and on the book! The specific method is: 1: Open the SQL Server Manager! On the left side, right-click 'security' and choose 'new'. In the "Logon" dialog box, enter your login number in the login name, select 'sqlserver Authentication', and enter the password, you can cancel 'user password must be changed upon next logon. Click User ing. On the right, select the database to be mapped and check the database! In the following column, check 'db-owner' and 'public. Click 'status' and select "authorize" and "enable" in the right pane. These two items are generally default, but if they are not by default, they must be changed, otherwise, it cannot be connected! Click confirm '. 2: Find the SQL Server, right-click it on the left bar, and select the "attribute" command in the pop-up menu. In the displayed dialog box, click "security" and select "SQL SERVER and WINDOWS Authentication Mode" under "SERVER Authentication". Check the preceding figure! Remember that this step is very important. If you do not have this step, you do not want to log on successfully! Click OK! 3: restart the service and select SQL SERVER Authentication Mode to log on! Enter your username and password to log on successfully!
Remember: The SQL2005 service must be restarted to take effect.