[Solved] How to Implement Audit trial in ASP.NET MVC [closed]

Define the business scenarios that need to be audited. Identify the code entry points where those scenarios happen Design the audit data model based on what data you want/need to store Write data in your audit table/tables on the previously identified code entry points This answer is intentionally vague. Auditing is not something that ASP.NET … Read more

[Solved] Selecting distinct values from multiple column of a table with their count

Get all column values to one row and find the count SQL SERVER ;WITH CTE AS ( SELECT COL1 Name FROM YOURTABLE UNION ALL SELECT COL2 FROM YOURTABLE UNION ALL SELECT COL3 FROM YOURTABLE UNION ALL SELECT COL4 FROM YOURTABLE UNION ALL SELECT COL6 FROM YOURTABLE UNION ALL SELECT COL7 FROM YOURTABLE ) SELECT DISTINCT … Read more

[Solved] Login screen using asp.net and SQL Server

This line of code: string checkuser = “select * from tb_Login where Username=”” + txtUsername.Text + “” and Password='” + txtPassword.Text + “‘ “; Is sending a query to the database and asking: “Give me all the columns from tb_Login whose UserName is the value in the txtUsername box and the Password is in the … Read more

[Solved] Can some expert please explain what this query is doing? [duplicate]

ROW_NUMBER in a subquery combined with a filter on it in the outer query is an idiom to filter out all but the first row in a group. So here ROW_NUMBER() OVER(PARTITION BY [dbo].[RegistrationHistory].[SerialNumber]) Assigns the row with the lowest SerialNumber 1, the next lowest, 2, etc. Then later where t.seq = 1 removes all … Read more

[Solved] How to find in and out time of every employee

You can group by id and cast(time_stamp as date) to create one row per person per day: select * , datediff(minute, first_in, last_out) as duration from ( select id , min(case when [Access Type] = ‘IN’ then time_stamp end) as first_in , max(case when [Access Type] = ‘OUT’ then time_stamp end) as last_out , cast(min(time_stamp) … Read more

[Solved] Updating a column based on values from other rows [closed]

Following your edit… DECLARE @T TABLE ( ID INT, CategoryID CHAR(4), Code CHAR(4), Status CHAR(4) NULL ) INSERT INTO @T (ID,CategoryID, Code) SELECT 1,’A100′,0012 UNION ALL SELECT 2,’A100′,0012 UNION ALL SELECT 3,’A100′,0055 UNION ALL SELECT 4,’A100′,0012 UNION ALL SELECT 5,’B201′,1116 UNION ALL SELECT 6,’B201′,1116 UNION ALL SELECT 7,’B201′,1121 UNION ALL SELECT 8,’B201′,1024; WITH T AS … Read more

[Solved] Get Count of Shared DataSet when defined with a Parameter

A workaround taken from this answer (Its not a duplicate question else I would flag it as such) is to create a hidden, multi-valued, parameter e.g. MyHiddenDataSetValues which stores the values from “MySharedDatasetWithParameter” and then =Parameters!MyHiddenDataSetValues.Count gives the number of rows. Rather clunky, so still hoping for a way to use CountRows. solved Get Count … Read more

[Solved] Sql Select From multiple table [closed]

You should write as: — STEP2: Insert records: INSERT INTO @Travels SELECT CountryId,VisitorId,0 FROM — 0 = false for IsVisited ( — STEP1: first create a combination for all visitor Id and country Id — and get all the combinations which are not there in existing Travels table SELECT C.CountryId,V.VisitorId FROM @Country C CROSS JOIN … Read more

[Solved] Where can I find the main query?

If you saved the query it will be on your local station somewhere with a .sql file extension. I think the default location would be C:\Users\\Documents\SQL Server Management Studio\Projects. As Lmu92 points out if you did not save the query it is probably gone. If you ran the query against the database and have not … Read more