private void Form1_Load(object sender, EventArgs e)
        {
            cn.Open();
        }

ERROR:Cannot open database "Persons" requested by the login. The login failed.
can anyone tell me how to fix this?

Recommended Answers

All 2 Replies

It means that your application is trying to login to sql and retrieve the data. but it's being prompted for a username and password. You need to specify this in your connection string for cn.

yeah, i forgot to copy and paste the new string since i deleted my previous database..., tnx

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.