Full Trust European Hosting

BLOG about Full Trust Hosting and Its Technology - Dedicated to European Windows Hosting Customer

Europe SQL 2017 Hosting - HostForLIFE.eu :: Delete Duplicate Rows From a Table in MSSQL 2017

clock January 24, 2019 10:34 by author Peter

For every table, we tend to use a primary key or distinctive key for distinct values, however generally we'll encounter a problem with duplicate records. it's a significant issue with duplicate rows. thus we want to delete duplicate records to resolve it. So here i'll make an example to explain delete duplicate rows in MSSQL 2017 Hosting.

Example:
First we create a simple database with one table for membership that contains: a Member's ID, Membership type, Firstname,  Lastname and Birthday:
CREATE TABLE [dbo].[Membership](
[MemberID] [varchar](20) NOT NULL,
[MemberType] [int] NOT NULL,
[Firstname] [varchar](80) NOT NULL,
[Lastname] [varchar](80) NOT NULL,
[Birthday] [date] NOT NULL
) ON [PRIMARY]

Now, insert the following rows into this table:

INSERT INTO dbo.Membership (MemberID, Firstname, Lastname, MemberType, Birthday) VALUES
('001', 'Peter', 'Smith', 1, convert(datetime, '05/23/1988', 0))
INSERT INTO dbo.Membership (MemberID, Firstname, Lastname, MemberType, Birthday) VALUES
('002', 'Scott', 'Davidson', 1, convert(datetime, '07/10/1983', 0))
INSERT INTO dbo.Membership (MemberID, Firstname, Lastname, MemberType, Birthday) VALUES
('002', 'Scott', 'Davidson', 1, convert(datetime, '07/10/1983', 0))

INSERT INTO dbo.Membership (MemberID, Firstname, Lastname, MemberType, Birthday) VALUES
('003', 'Kevin', 'Richard', 1, convert(datetime, '04/24/1985', 0))

We currently have duplicated Scott Davidson’s entry (MemberID 2), with no clearly safe method of removing the duplicate, whereas leaving at least one entry intact. Now, imagine if you had a complete databse of information with a whole lot or thousands of duplicates. Fixing this by hand quickly becomes an impossible task!

To solve this, first we can add an column using the IDENTITY keyword so we currently have a unique method of addressing every row:
ALTER TABLE dbo.Membership ADD AUTOID INT IDENTITY(1,1)

We can then we can use:
SELECT * FROM dbo.Membership WHERE AUTOID NOT IN (SELECT MIN(AUTOID) _
FROM dbo.Membership GROUP BY MemberID)

Which will properly choose all duplicated records in our database (always worth checking before running the delete query!).  Once we are happy this is working for us, we can then run the delete query:

DELETE FROM dbo.Membership WHERE AUTOID NOT IN (SELECT MIN(AUTOID) _
FROM dbo.Membership GROUP BY MemberID)



Windows Hosting Europe - HostForLIFE.eu :: How To Use ServerSide Processing With jQuery Datatable?

clock January 15, 2019 10:37 by author Peter

What is the benefits of using  ServerSide Processing with JQuery Datatable? I personally found two important benefits of using ServerSide Processing with Datatable. We can handle more data using JQuery Datatable. Data can load quickly from the Database server .

Follow the following steps to use ServerSide processing with Datatable.

Step 1
Add JQuery  Js file  ,and Jquery Datatable css and Js file as shown in the below figure.

Add the following script to your .aspx page.
<!-- DataTables CSS --> 
<link rel="stylesheet" type="text/css" href="http://ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.4/css/jquery.dataTables.css"> 

<!—jQuery Js --> 
<script type="text/javascript" charset="utf8" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.2.min.js"></script> 

<!-- DataTables  JQuery file--> 
<script type="text/javascript" charset="utf8" src="http://ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.4/jquery.dataTables.min.js"></script> 


Step 2
Create one WebService to Getdata (Here I am using asp.net WebService to get data). You can see  my Solution Explorer . I have two web pages and one service, and the name of the service is webService.asmx.

 

Step 3
Create method inside service which will return data to bind Jquery Datatable.
[WebMethod] 
    public void HelloWorld() 
    { 
        List<MyClass> lst = new List<MyClass>(); 
        int i = 0; 
        while (i < 10000) 
        { 
            lst.Add(new MyClass() { Empid = "1", Name = "Ar"}); 
            lst.Add(new MyClass() { Empid = "2", Name = "Br" }); 
            lst.Add(new MyClass() { Empid = "3", Name = "Cr" }); 
            i = i + 1; 
        } 
       var mydata=new DataTable() 
       { 
       aaData=lst,iTotalDisplayRecords=lst.Count,iTotalRecords=lst.Count 
       }; 
        JavaScriptSerializer js=new JavaScriptSerializer(); 
        js.MaxJsonLength = int.MaxValue; 
      Context.Response.Write(js.Serialize(mydata)); 
     
 } 


In the above code you can see that I have defined one function named HelloWorld. editsInside the HelloWorld function I have used three classes.These three classes are MyClass, DataTable and JavaScriptSerializer. Now defined the MyClass inside the service class as I have defined below.

public class MyClass 

    public string Empid { get; set; } 
    public string Name { get; set; } 


Now define the second class DataTable as I have defined below.
public class DataTable 

    public int iTotalRecords { get; set; } 
    public int iTotalDisplayRecords { get; set; } 
    public List<MyClass> aaData { get; set; } 


JavaScriptSerializer class is  available inside System.Web.Script.Serialization namespace.Add this namespace to your service class.

Step4
Design Table from the following code.
<table id="example" class="display" width="100%" cellspacing="0"> 
 
<thead> 
    <tr> 
        <th >Employee Id</th> 
        <th >Name</th> 
         
    </tr> 
    
</thead> 
</table> 

Step 5
Now use Ajax to call Service method and bind data to Jquery Datatable as shown in the below code.
<script> 

$(document).ready(function () 


example').dataTable({ 
"bProcessing": true, 
"sAjaxSource": "WebService.asmx/HelloWorld", 
"sServerMethod": "post", 
"aoColumns": [ 

               { mData: 'Empid' }, 
               { mData: 'Name' },  
           
          ] 

                });    

                    ); 
</script> 


Step 6
Now run your application and see the result.



DotNetNuke Hosting - HostForLIFE.eu :: Changing Default DotNetNuke Text Editor

clock January 8, 2019 11:18 by author Peter

Maybe you're wondering after done an upgrade to a newer version in Dotnetnuke (DNN), your text rich editor is still on the old version. In this tutorial, I will show you how you can switch between the old and the new text editor quickly. 

To change the default text editor provider of your website is pretty easy. To do it, just open your web.config file located on your root folder. Then, look for the following words:

Below is the full sample text grabbed from the web.config file.

<htmleditor defaultprovider="DotNetNuke.RadEditorProvider">
    <providers>
    <add name="TelerikEditorProvider" type="DotNetNuke.HtmlEditor.TelerikEditorProvider.EditorProvider, DotNetNuke.HtmlEditor.TelerikEditorProvider" providerpath="~/Providers/HtmlEditorProviders/Telerik/" toolsfile="~/Providers/HtmlEditorProviders/Telerik/Config/ToolsDefault.xml" configfile="~/Providers/HtmlEditorProviders/Telerik/Config/ConfigDefault.xml" filterhostextensions="True"></add>

    <add name="DotNetNuke.RadEditorProvider" type="DotNetNuke.Providers.RadEditorProvider.EditorProvider, DotNetNuke.RadEditorProvider" providerpath="~/DesktopModules/Admin/RadEditorProvider"></add>

    </providers>
</htmleditor>

If you want to switch around between TelerikEditorProvider or DotNetNuke.RadEditorProvider, uou just need to specify the name of the provider and place the default html provider name in the orange background location like this:

htmleditor defaultprovider="DotNetNuke.RadEditorProvider"

HostForLIFE.eu DotNetNuke 7.4 Hosting
HostForLIFE.eu is European Windows Hosting Provider which focuses on Windows Platform only. We deliver on-demand hosting solutions including Shared hosting, Reseller Hosting, Cloud Hosting, Dedicated Servers, and IT as a Service for companies of all sizes. We have customers from around the globe, spread across every continent. We serve the hosting needs of the business and professional, government and nonprofit, entertainment and personal use market segments.



About HostForLIFE.eu

HostForLIFE.eu is European Windows Hosting Provider which focuses on Windows Platform only. We deliver on-demand hosting solutions including Shared hosting, Reseller Hosting, Cloud Hosting, Dedicated Servers, and IT as a Service for companies of all sizes.

We have offered the latest Windows 2016 Hosting, ASP.NET Core 2.2.1 Hosting, ASP.NET MVC 6 Hosting and SQL 2017 Hosting.


Tag cloud

Sign in