Skip to content
Advertisement

Tag: c#

How to show current login User details in profile using ASP.NET MVC

I want to show user details on User Profile using Session but it is not working any other way kindly suggest me, I’m using ASP.NET MVC. Login class: Dashboard controller: Screenshot of output: Answer When you use a session, that session is available throughout the site based on how long you have given it in the web config file. And

add sql WHERE statement to select new ID:s in database (asp / sql)

I’m trying to update a website where there’s new ID’s for different damage groups. All the new ID’s start after ID 139. In SQL the statement to get the new groups are simply: However, I want to implement the same statement in my ASP code and in the method that fetches the current damage groups. Here’s the current method for

What is the proper way of selecting multiple scalars within the same “using” statement with Dapper?

I have wrote the following method, which I hoped to make the method run faster by executing the tasks in parallel: Unfortunately, I receive the following exception: System.InvalidOperationException: ‘BeginExecuteReader requires an open and available Connection. The connection’s current state is connecting.’ How should I implement it correctly? Answer First things first, executing many commands in parallel against a database will

Is there a way to SELECT a database table using a variable?

I tried this statement: string query = “SELECT question FROM ‘” + GlobalVariables.dbQCode + “‘ WHERE [question_code] = ‘” + GlobalVariables.questionCode + “‘ “; and when I run the code it is giving me an exception: Syntax error in query. Incomplete query clause. Is there a way where I can use my variable? I want it to work because I

SQL Filter by dateTime

day is a integer variable. If I set the day value to 1, database is filtering for 24 hours. But if I set the day value to 1, I only want to see the logs of the new day. How can I do that? Thank you for your help. Answer

Advertisement