Use MSDE in. Net to access the database

Source: Internet
Author: User

First, let's explain MSDE, the full name is Microsoft Desktop Engine (Microsoft Desktop Engine )!
We all know that SQL Server cannot be installed in non-server systems.
Is it because we cannot access the database in such an operating system! That's definitely not it!
Otherwise, it's really nonsense! Pai_^

My development environment is 2000 professinal + VB. net2003!

If you cannot install the server, you cannot select the Authentication Mode of the login server. Therefore, if you try to use Server = localhost; uid = sa; Pwd =; when a string such as database = xxx is used to connect to the database, the following error occurs: system. data. sqlclient. sqlexception: User 'sa 'Logon Failed. Cause: it is not associated with a trusted SQL server connection.

Isn't that nonsense? Which sa user has not installed the database?

Don't scold me. I just want to give the most authentic error message! ):

In this case, you may discard the mixed Authentication Mode to try windows integrated authentication.
The settings in Web. config are as follows:
<Deleetask>
<! -- System Configuration -->
<Add key = "sqlserver1" value = "Data Source = localhost; initial catalog = model; Integrated Security = sspi;"/>
</Appsettings>

You may be confident that the data you carefully designed will be displayed on the page!

But what about the results?

I'm very disappointed with you!

Error: system. Data. sqlclient. sqlexception: the database requested to log on to 'model' cannot be opened. Logon Failed. User 'zzq \ aspnet' Login Failed.

Shit!

But here I think if you are not stupid, you have found a solution based on the error prompt!
I am not stupid, so I will try the following steps:
1. Open the Enterprise Manager and find the local database. Note that local registration is not your new registration, otherwise the discussion here may be meaningless.
2. Find the database you want to use, the sample database of the system I use here, model.
3. Expand the database, right-click the user entry, and select create database user.
4. In the displayed dialog box, the System user (Windows User) will be displayed in the drop-down list of login names, and the computer name \ ASPnet will be selected. The user name can be left unchanged.
5. Select the corresponding action in the check box allowed by the database role. If you want to give the user the opportunity to attack the database, select db_owner! Pai_^

Everything is OK!
Press F5 to check the effect! Is it a sense of accomplishment?

Afterwards: This article has no technical content, but it is a bit of a record in the actual operation process!
Write down these things to make it easier for colleagues who encounter such problems for the first time! This article makes some sense.

 


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.