Resolved Please help me with asp.net and mongoDB

aadi56

New member
Joined
Dec 28, 2020
Messages
3
Programming Experience
Beginner
I am trying to make employee registration page in asp.net with database as MongoDB. What I want to do is to have the unique email id, when a user tries to register with a email id it should show that email id already exists in the database I am not able to figure out how to do this in MongoDB While in Asp+ SQL there are tons of resources but not in Asp+mongoDb Here is the pastebin , I have included Model class & Controller Class.

hastebin

I am not able to figure out how to show Error message if user tries to register with same email id

 
It doesn't matter what database you're using. The exact same principle applies regardless. You will just use a different ADO.NET provider and the SQL may change slightly but a query is still a query. Whatever steps you would perform for a SQL Server database are the same steps you would perform for any other database.
 
So basically you want to learn how do a query in Mongo like a query you used to do a query is SQL. So how is this a C# question? Sounds like a Mongo question.
 
But I do have to use that query in my asp.net code and have to call back that code in my controller file ?
 
How would you do it with SQL? You would do the same with Mongo.
 
If you know how to use ADO.NET with SQL Server then you know how to use ADO.NET with any database because it's basically the same regardless. If you can use a SqlConnection, SqlCommand, SqlDataAdapter, etc, for SQL Server then you can use an OleDbConnection, OleDbCommand, OleDbDataAdapter, etc, for any OLE DB data source, or you can use a dedicated third party ADO.NET provider if one exists for your data source, e.g. Connector/Net for MySQL.

If you don't know how to use ADO.NET then you should research how to use ADO.NET. Once you've done that, you can make your best attempt to use the information you have found and then post back here if and when you encounter an actual issue.
 
Last edited:

Latest posts

Back
Top Bottom