"If at first you don't succeed; call it version 1.0" :-Unknown

Pages

Wednesday, April 22, 2015

Total number of records of all tables in a MSSQL database

Total number of records of all tables in a MSSQL database


Run the below query agganist the database you want the result


SELECT      QUOTENAME(SCHEMA_NAME(sOBJ.schema_id)),QUOTENAME(sOBJ.name) AS [TableName]      , SUM(sdmvPTNS.row_count) AS [RowCount]FROM      sys.objects AS sOBJ      INNER JOIN sys.dm_db_partition_stats AS sdmvPTNS            ON sOBJ.object_id = sdmvPTNS.object_id
WHERE      sOBJ.type = 'U'
      AND sOBJ.is_ms_shipped = 0x0      AND sdmvPTNS.index_id < 2GROUP BY
      sOBJ.schema_id
      , sOBJ.name      having SUM(sdmvPTNS.row_count)>0ORDER BY [TableName]
GO




If u had any trouble just ask, Happy to help u :)
Stay Tune...
Have a nice day... 'N happy Coding :)

Friday, May 2, 2014

Introducing MathCap for Asp.Net [ Math Captcha Plugin ]

MathCap is a plugin for .net application and its a 100% effective and easy to use.the more you understand on a deep look.

Here i shared is the base version of Mathcap 1.0.0. More feature are coming on a newer versions.

How it use?

add mathcapp dll reference

invoke the namespace on the webpage using MathCapcha;

Add the below code
                var bitmapImage = new Capcha();
                var properties = new MathCapchaProperties();
now customise the properties


now get the response and point to image control, using below code.

               var imgur = bitmapImage.CreateThumbnail(properties);
 
               img.Src = imgur.bmpImageSource; 
               Response.Write(imgur.answer);

Output














NOTE: In near by future itself 'm planning to make it a control but before that i need to add some cool feature that by i made it like this :)

DOWNLOAD dll From here

If u had any trouble just ask, Happy to help u :)
Stay Tune...
Have a nice day... 'N happy Coding :)

Wednesday, April 2, 2014

GET SET in C#

Get:
The get { } implementation must include a return statement. It can access any member on the class.

Set:
The set { } implementation receives the implicit argument 'value', which is the value to which the property is assigned.

Thursday, March 13, 2014

keep the sessionID on url

keep the sessionID on url

Recently i found an intersting stuff around axisbank url.


Monday, March 3, 2014

upcoming feature in c#

1.Add "?." operator to C#

2.Allow "default" values on automatic properties


These are some of the upcoming feature expecting in c# by there next update.http://visualstudio.uservoice.com/  visual studio admin team announced these stuff. 
 more info:
http://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/3990187-add-operator-to-c-
http://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/2163145-allow-default-values-on-automatic-properties

If u had any trouble just ask, Happy to help u :) 
Stay Tune... 
Have a nice day... 'N happy Coding :)

Tuesday, January 28, 2014

Restore data after browser crash

Restore data after browser crash

Its a client requirement and we implemented by using html 5 localstorage feature. Here i'm providing a sample of that.

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Local storage</title>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
</head>
<body>
    <div>
        <div>
            <div>
                <label>Name:</label>
            </div>
            <div>
                <input type="text" id="name" />
            </div>
            <div>
                <input type="button" id="btnSave" value="Save" />
            </div>
        </div>
    </div>
    <script type="text/javascript">
        $(document).ready(function () {
            function init() {
                if (localStorage["name"]) {
                    $("#name").val(localStorage["name"]);
                }
            }
            init();
        });
        $('input').change(function () {
            localStorage[$(this).attr("id")] = $(this).val();
        });
        $("#btnSave").click(function() {
            localStorage.clear();
        });
    </script>
</body>
</html>

DEMO




If u had any trouble just ask, Happy to help u :)
Stay Tune...
Have a nice day... 'N happy Coding :)

Wednesday, January 15, 2014

Quick walk over most used JavaScript function

Quick walk over most used JavaScript function

Again a url :). This one helps to make a quick walk over the stuff we done previously.

https://code.google.com/p/jslibs/wiki/JavascriptTips

If u had any trouble just ask, Happy to help u :)
Stay Tune... Have a nice day... 'N happy Coding :)

Tuesday, January 14, 2014

everything (almost) about ViewState

Recently i had read an article about the view state management in c# and its go through much deeply also.
 http://aspnetresources.com/articles/ViewState

Thanks to the author for sharing such a good articles :)


If u had any trouble just ask, Happy to help u :)
Stay Tune...
Have a nice day... 'N happy Coding :)

Thursday, December 19, 2013

Using linq and lambda expression in c#

using linq and lambda expression in c#

using linq and lambda expression in c# to filter data.


  • Select all
  • Select some filed
  • Select filtering data with condition
  • Select Anonymous Type / Casting
  • Merging two columns
  • Ordering
  • Joining two list
  • Skip and Take 


Monday, November 11, 2013

button click event not fire from jquery dialog

button click event not fire from JQUERY dialog


Its a common issues.the defalut value of button property "UseSubmitBehavior" is true.

That expresses the button will use the browser's submit mechanism. However, jQuery Dialog UI is manipulating it.

There exists a conflict. If you want to fired the button click event. Please set its property "UseSubmitBehavior" as false.

<asp:Button ID="Button1" runat="server" Text="Button"  UseSubmitBehavior="false" OnClick="Button1_Click" />


If u had any trouble just ask, Happy to help u :)
Stay Tune...
Have a nice day... 'N happy Coding :)

Thursday, November 7, 2013

Pagging in sql

In one of my older post i posted about  paging in sql using Row_Number function (http://simplyasp.blogspot.in/2010/11/paging-records-using-sql-server-2005.html).on latest version of sql they had improved the paging functionality by bothe performance base and also in readbility base too. on 2008  they introduce CTE (Common table expression) and Derived table.  on sql 2012 they done a mass step on that FETCH NEXT functionality ... i love that.

Below i show all the method of paging i mentioned above.

--SQL 2005/2008 Paging Method Using Derived Table
DECLARE @Start INT
DECLARE @End INT
SELECT @Start = 14000,@End = 14050

 
SELECT LastName, FirstName, EmailAddress
FROM (SELECT LastName, FirstName, EmailAddress,
      ROW_NUMBER() OVER (ORDER BY LastName, FirstName, EmailAddress) AS RowNumber
      FROM Employee) EmployeePage
WHERE RowNumber > @Start AND RowNumber <= @End
ORDER BY LastName, FirstName, EmailAddress
GO

 
--SQL 2005/2008 Paging Method Using CTE
DECLARE @Start INT
DECLARE @End INT
SELECT @Start = 14000,@End = 14050;

 
WITH EmployeePage AS
(SELECT LastName, FirstName, EmailAddress,
 ROW_NUMBER() OVER (ORDER BY LastName, FirstName, EmailAddress) AS RowNumber
 FROM Employee)
SELECT LastName, FirstName, EmailAddress
FROM EmployeePage
WHERE RowNumber > @Start AND RowNumber <= @End
ORDER BY LastName, FirstName, EmailAddress
GO

 
--SQL SERVER 2012
SELECT LastName, FirstName, EmailAddress
FROM Employee
ORDER BY LastName, FirstName, EmailAddress
OFFSET 14000 ROWS

FETCH NEXT 50 ROWS ONLY;

If u had any trouble just ask, Happy to help u :)
Stay Tune...
Have a nice day... 'N happy Coding :)

Wednesday, October 30, 2013

linq to loop through datatable c#

Iterating through a data table using linq in c#

i faced a criteria to trim a row value with some criteria,

Before trimming

 



After trimming















C# Code





If u had any trouble just ask, Happy to help u :)
Stay Tune...
Have a nice day... 'N happy Coding :)

Tuesday, September 24, 2013

Monday, September 23, 2013

Action Delegates in c#

In my last post i shown FUNC Delegates now going around ACTION delegates
        
            Action instance can receive parameters, but cannot return values.
 Example below:
  1. How to execute a line
  2. How to execute a method

Thursday, September 19, 2013

Wednesday, September 18, 2013

SQL Function return SQL TABLE


using table values parameter we can achieve it

Function :

CREATE FUNCTION FunctionName
(
@id INT
)
returns table as
return
(
Select * from TableName WHERE id=@id
)

How to call:

select * from FunctionName(1)

If u had any trouble just ask, Happy to help u :)
Stay Tune...
Have a nice day... 'N happy Coding :)

Tuesday, September 17, 2013

HAPPY ONAM 2013


I Wish You A Very Happy Onam,
May The God Bless You And Fill Your Heart
With Joy & Happiness.
May The Color And Lights Of Onam Fill Your Home
With Happiness And Joy.
Have The Most Beautiful Onam.





Monday, July 15, 2013

Accessing active directory using c#

Hi *.*,
Today i'm sharing a snippet to Accessing active directory using c#. i had created a class file for modular access.Here it goes



using System;
using System.DirectoryServices.AccountManagement;
using System.DirectoryServices;
using System.Configuration;
using System.Collections.Generic;

Thursday, July 4, 2013

Tutorial for Visual Studio Zen Coding

Visual Studio Zen Coding is a visual studio plugin for high-speed HTML, XML, XSL (or any other structured code format) coding and editing.

Just type HTML tag in zen syntax and press alt + z to expand tag to normal form. Its so smooth as touching a flower.

Visual Studio Zen Coding 2012