question

Donald-0878 avatar image
0 Votes"
Donald-0878 asked Donald-0878 commented

Error in signing up in my website

I recently uploaded my website files and MSSQL database to plesk. and when I opened my site in a browser it opened perfectly. I then tried to create a new account which will insert my data into the database, but I got an error which states:

Server Error in '/' Application.
Login failed for user 'quirverT'.

Please forum, I need your help on this. how do I resolve this issue?

Here is the connection string I used to connect to the database; may I please know if its correct the way I use it?
am I to use or include username and password?

(SqlConnection con = new SqlConnection ="Data Source=N1NWPLSK12SQL-v02.shr.prod.ams1.secureserver.net;Initial Catalog=Quirver_DB;User ID=quirverT;Password=***");

here is a screenshot of the error
![201614-login-server.png][1]


sql-server-general
login-server.png (90.2 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Cathyji-msft avatar image
0 Votes"
Cathyji-msft answered Donald-0878 rolled back

Hi @Donald-0878,

Please use SSMS to connect to your SQL server instance. Then check whether the login quirverT is existed under SQL server security login folder. Your SQL server instance has been enabled SQL server authentication. Right click SQL server instance, click security properties. You need to restart your SQL server service to make this change effect. And this login has permission to connect to SQL server instance.
201628-screenshot-2022-05-13-134921.jpg

201673-screenshot-2022-05-13-134957.jpg

SqlConnection ="Data Source=N1NWPLSK12SQL-v02.shr.prod.ams1.secureserver.net;Initial Catalog=Quirver_DB;User ID=quirverT;Password=***")

You have some mistakes in your connection string, we use IP address, port number or instance name for data source. Please correct it, refer to this blog SQL Server connection strings. Such as below;

 Server=myServerName\myInstanceName;Database=myDataBase;User Id=myUsername;Password=myPassword;
 Data Source=myServerAddress;Initial Catalog=myDataBase;User ID=myUsername;Password=myPassword;


If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".




· 7
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

You mentioned that there are mistakes in my connection string. But I checked the two examples you gave and compared with mine; I see no change. The second connection string is exactly like mine

0 Votes 0 ·
0 Votes 0 ·

No. That's my server host.
But this is the second connection string you posted

Data Source=myServerAddress;Initial Catalog=myDataBase;User ID=myUsername;Password=myPassword;

Isn't it similar to mine?

0 Votes 0 ·

Where is connection string gotten from, please?

0 Votes 0 ·

The connection string is correct, see https://www.connectionstrings.com/sql-server/
The issue is the used login, see my previous post.

0 Votes 0 ·

I got my connection string from visual studio.
I hope it's where it can never gotten, or
Where can I get the connection string?

0 Votes 0 ·

Hi @Donald-0878,

I am not familiar with VS, i search this from MS document. Quote from MS document;

You can view the connection string for the SampleDatabase.mdf file by opening the Properties window of the data connection:

•Select View > SQL Server Object Explorer to open the SQL Server Object Explorer window. Expand (localdb)\MSSQLLocalDB > Databases, and then right-click on SampleDatabase.mdf and select Properties.
•Alternatively, you can select View > Server Explorer, if that window isn't already open. Open the Properties window by expanding the Data Connections node, right-clicking on SampleDatabase.mdf, and then selecting Properties.


0 Votes 0 ·
OlafHelper-2800 avatar image
0 Votes"
OlafHelper-2800 answered Donald-0878 commented

Login failed for user 'quirverT'.

A clear error message, the SQL login 'quirverT' don't have permission to logon to the SQL Server.
Make care that SQL Server is running in Mixed Mode = Win+SQL Auth, the SQL login exists, have permissions to logon and permission to access the database in mind.
· 4
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

The SQL Server is running in Mixed Mode = Win+SQL Auth.

How do I check if the login exists?

How do I give permissions to logon and permission to access the database?

0 Votes 0 ·

You can check this like my screenshots.

0 Votes 0 ·

Yes. The login exists.
I noticed something though.
When I checked the password from the copied connection string in VS .cs file I counted the number if characters in my password and it was not equal to the password I created for my database in plesk

0 Votes 0 ·

I opened SSMS and right-clicked on my server instance, I opened security, then Logins. I saw my username "quirverT". I right-clicked on the user to open Login properties. I selected status and the permission has been granted to the user.

I also checked a user "sa"; there is a red 'X' sign on the user. So I opened its Login properties and selected status and saw that permission was Login was disabled, so I changed it to Enabled. and clicked okay. but got an error
201578-error.png


201687-capture-sql.png


201579-capture-sql-2.png


0 Votes 0 ·
error.png (15.0 KiB)
capture-sql.png (127.0 KiB)
capture-sql-2.png (121.8 KiB)