How to apply paging in SQL Query ?

Easy way apply paging in SQL Query 

Steps by Step 

  1.  Pass the page number and how many records per page you would like to fetch 
  2. Remember to  have ORDER BY column name in your query


DECLARE @PageNumber AS INT, 
@RowsperPage AS INT
SET @PageNumber = 1
SET @RowsperPage = 10
SELECT * 
FROM cu_customer 
ORDER BY CustomerID
OFFSET ((@PageNumber – 1) * @RowsperPage) ROWS
FETCH NEXT @RowsperPage ROWS ONLY OPTION (RECOMPILE);

Easy Google Search

How to share easy search link to friend?


1. Go to http://lmgtfy.com/ website

2. Choose Search engine like “Google, Bing, Yahoo .. etc “

3. Enter the search text you want to search

4. Click on “Get Link” Button 

5. Click on “Preview” Button to view before you share with your friends 

6. Copy the URL link and share it with your friends 


Demo : Click me

LINQ – Data source Group By Sum

 LINQ


            DataTable table = new DataTable();
            table.Columns.Add(“ID”, typeof(int));
            table.Columns.Add(“Percentage”, typeof(int));

            table.Rows.Add(1, 50);
            table.Rows.Add(1, 30);
            table.Rows.Add(2, 0);
            table.Rows.Add(2, 100);

            var result = (from p in table.AsEnumerable()
                          group p by p[“ID”] into r
                          select new
                          {
                              ID = r.Key,
                              Percentage = r.Sum((s) => decimal.Parse(s[“Percentage”].ToString()))
                          }).ToList();
_________________________________________________
INPUT :

ID | Percentage |
1       50
1       30
2         0
2       100

OUTPUT :

ID | Percentage |
1       80
2       100

SQL Server Instance Connection Error

SQL Server Instance Connection Error 


ERROR 
A network-related or instance-specific error occurred while establishing a connection to SQL Server.
The server was not found or was not accessible.
Verify that the instance name is correct and that SQL Server is configured to allow remote connections.
(provider: TCP Provider, error: 0 – The remote computer refused the network connection.) (Microsoft SQL Server, Error: 1225)

 Route Cause 
Mainly, MSSQL Server instance service is not active at 2 places                                                      
1. Microsoft SQL Server Configuration Manager
2. Windows Services
Solution 
1. Just note that which MSSQL version you have installed first based on that you need to open SQL Server Configuration Manager first as listed below

SQL Server 2016
C:\Windows\SysWOW64\SQLServerManager13.msc
SQL Server 2014
C:\Windows\SysWOW64\SQLServerManager12.msc
SQL Server 2012
C:\Windows\SysWOW64\SQLServerManager11.msc
SQL Server 2008
C:\Windows\SysWOW64\SQLServerManager10.msc

2. Check which one you have installed on your machine, and copy the file path
3. Go to Run –> paste –> Press Enter
4. SQL Server Configuration window gets opened.
5. At the left panel, click on “SQL Server Services” and right panel  choose the instance you have installed, and right click start the service
6. Go to Run command type–> services.msc –> press Enter
7. Find the SQL server same instance and right click and start the service 
8. Close all the application opened.
9. All done now, Open MSSQL server  and connect as usual.
10. Good to go now 






MySQL Query Browser Error

ERROR !!!!!
Could not connect to the specified instance. MySQL Error Number 2003.
Can’t connect to MySQL server on ‘localhost ‘ (10061)
https://4.bp.blogspot.com/--sDPmlj1tC8/WDT_8bhpToI/AAAAAAAACkY/upnrwpyQ2SkOoGuR9mO91tM7OnhD2cE0QCLcB/s320/MySQL%2BConnection%2BError.png
 Resolution 1 
1.  Go to  Run Command à type à services.msc  press Enter
2.  Find MySql Services and Restart service
3. Open MySql Query Browser connect .
Resolution 2
1. If you do not find MySql service in services screen, it means that you have not installed MySql 
2. Install setup “mysql-5.5.42-winx64.exe” 
3. Open MySql Query Browser and connect again..
4. Good to go !!!

Visual Studio 2015 Invalid Pointer

Visual Studio 2015 Invalid Pointer

ERROR !!!!!
Error while running Visual Studio 2015 project, Click on below image to view error


 Route Cause 
Some dll files are not loaded in to assembly correctly.
Ex:
CreateInstance failed for package [Microsoft.VisualStudio.TraceLogPackage.TraceLogPackage]
Could not load file or assembly Microsoft.VisualStudio.Diagnostics.HubExtensions, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
Resolution 2
If you are not sure what causing this error, need to check Visual Studio Activity Log file.
1.     Go to Run command and paste ” %APPDATA%\Microsoft\VisualStudio” press Enter
2.     You find folder name “14.0” open it 
3.     Find file name “ActivityLog.xml” open it and scroll down to the bottom
4.     Read the exception error message fully.
Note
1.     Important, please close all the visual studio and sql server applications opened
2.     Go to “Control Panel\All Control Panel Items\Programs and Features” 
3.     Find “Microsoft Visual Studio Enterprise 2015” 
4.     Right Click and click on Change  button
5.     Visual Studio dialog opens now click on “Repair” Button, this might take a while
6.     Restart your PC/Laptop
7.     Run Visual Studio. 
8.     Good Luck !! Here you go… 🙂
Design a site like this with WordPress.com
Get started