Posts

Create Auto Increment ID in Table with data

Step 1 Create new Column as ID in Table with data type INT. Step 2 Update table with below query . ;WITH cte AS (     SELECT *, RowNum = ROW_NUMBER() OVER (ORDER BY GETDATE())     FROM  TableName ) UPDATE cte SET ID = RowNum + 1 WHERE (RowNum = RowNum) Step 3 Modify the ID column Identity (1,1)

Find Days of Month In Teradata

Find Days of Month In Teradata select extract(month from current_date) as monthofyear, CASE extract(year from current_date) MOD 5 WHEN 0 THEN CASE monthofyear WHEN 1 THEN 31 WHEN 2 THEN 29 WHEN 3 THEN 31 WHEN 4 THEN 30 WHEN 5 THEN 31 WHEN 6 THEN 30 WHEN 7 THEN 31 WHEN 8 THEN 31 WHEN 9 THEN 30 WHEN 10 THEN 31 WHEN 11 THEN 30 WHEN 12 THEN 31 END ELSE CASE monthofyear WHEN 1 THEN 31 WHEN 2 THEN 28 WHEN 3 THEN 31 WHEN 4 THEN 30 WHEN 5 THEN 31 WHEN 6 THEN 30 WHEN 7 THEN 31 WHEN 8 THEN 31 WHEN 9 THEN 30 WHEN 10 THEN 31 WHEN 11 THEN 30 WHEN 12 THEN 31 END END

Using Facebook login in ASP.NET application

Image
Using Facebook login in ASP.NET application Step-1: Register site in Facebook: Open http://developers.facebook.com and login with your Facebook credentials after logging in you will get a screen like this: Click on "Build for Websites" link, you will reach to https://developers.facebook.com/docs/guides/web/ , just click on 'Apps' menu Items (the last menu Item from right side), you will reach to https://developers.facebook.com/apps. Click on   button, you will get following screen. Enter the name of your website in place of App Name, rest of the fields are optional so fill them if you require to use them and click on 'Continue' button. you will be asked to fill a captcha screen and then you will get the summary screen like below screenshot (Just masked the AppID). Give the URL of you webs...

Convert Unix Time Stamp To System Date Time

Convert Unix Time Stamp To System Date Time Step 1 Copy the function code below and paste in your page.   public string ConvertToUnixTimeStapToDateTime(double timestamp)     {                 // First make a System.DateTime equivalent to the UNIX Epoch.         System.DateTime dateTime = new System.DateTime(1970, 1, 1, 0, 0, 0, 0);         // Add the number of seconds in UNIX timestamp to be converted.         dateTime = dateTime.AddSeconds(timestamp);         // The dateTime now contains the right date/time so to format the string,         // use the standard formatting methods of the DateTime object.         string resDate = dateTime.ToShortDateString() + " " + dateTime.ToShortTimeString();         return resDate;     } Step 2 Call the function and p...

Download Pre-Request patch file for SharePoint 2010 Installation

Download Pre-Request patch file for  SharePoint 2010 Installation Pre-Request patch file download for SharePoint 2010 Software. Click on below link for download pre request file... 1.SQL Native Client 2.Hotfix for Microsoft Windows (KB976462) – NET 3.5 SP1 HotFix or Windows 2008 R2 3.Windows Identity Foundation (KB974405) for Windows 2008 R2 4.Microsoft Sync Framework Runtime v1.0 (x64) 5.Microsoft Chart Controls for Microsoft .NET Framework 3.5 6.Microsoft Filter Pack 2.0 7.Microsoft SQL Server 2008 Analysis Services ADOMD.NET 9.Microsoft Server Speech Recognition Language - TELE(en-US) 10.SQL 2008 R2 Reporting Services SharePoint 2010 Add-in

Convert HtmlToPDF in ASP.net & iTextshrap

Convert Web Page to PDF  in ASP.net & iTextshrap Step 1 Download iTextSharp dll from below link's Download iTextSharp dll iTextsharp_Dll Download Step 2 Create a sample website in .net . Add reference the downloaded dll . Step 3 Create a page  and design you report in this web page and put one button for Export to pdf . Step 4 C# Add namespaces below  . using System.IO; using iTextSharp.text; using iTextSharp.text.html.simpleparser; using iTextSharp.text.pdf; using System.Text; Copy and Paste below code in Export Button click event .  Response.ContentType = "application/pdf";         Response.AddHeader("content-disposition", "attachment;filename=TestPage.pdf");         Response.Cache.SetCacheability(HttpCacheability.NoCache);         StringWriter sw = new StringWriter();         HtmlTextWriter hw = new HtmlTextWriter(sw);     ...

Stock Quote and Chart with yahoo using c#

Stock Quote and Chart with yahoo using c# Step 1 Create a website with visual studio and copy the below code paste in your page code behind . Code    protected void Page_Load(object sender, EventArgs e)         {             if (!IsPostBack)             {                 // The page is being loaded and accessed for the first time.                 // Retrieve user input from the form.                 if (Request.QueryString["s"] == null)                     // Set the default stock symbol to YHOO.                     m_symbol = "STER.NS";                 else                   ...