Tuesday, 25 December 2012

Subtract and Concatinate date and time from a table and get the date and update in table


UPDATE lock_TKT
SET  TOTAL_TIME=To_Days(CONCAT(`fix_date`,' ',`fix_time`))-To_Days(CONCAT(`Tran_date`,' ',`lock_time`))
where ticket_no in ( select ticket from excelupload)

How to upload CSV file using Toad for MySql


-- Conditionally drop the table.
DROP TABLE IF EXISTS excelupload;

-- Create the new upload target table.
CREATE TABLE excelupload
( ticket   int(20)
, remarks varchar(500) ) ENGINE=MEMORY;

-- Load the data from a file, don't forget the \n after the \r on Windows or it won't work.
LOAD DATA INFILE 'f:/tickettoclose.csv'
INTO TABLE excelupload
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
ESCAPED BY '\\'
LINES TERMINATED BY '\r\n';

-- Select the uploaded records.
SELECT * FROM excelupload;

Thursday, 13 December 2012

How to set the program at windows start

create a shortcut to the program you want to run then put the short cut in your start> all programs> start up with msconfig you can disable programs that have start up keys in the registry in the start up section

Wednesday, 14 November 2012

How to Search a word and check where it used in ASP.net

Using Ctrl+Shift+F we can search with suggested all the pages where the searched word are used

Wednesday, 7 November 2012

How to Import Excel file data in MySql table



Step-1: Create .CSV file of the data.

Step-2: Create data bse and table name in which you want to upload the data

Step-3: Run the following details of MySql Command Prompt:

mysql> LOAD DATA LOCAL INFILE 'C:\\emp.csv' INTO TABLE emp_details.emp_data FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\r\n' (id, name);

Friday, 5 October 2012

How to Subtract the two date in C#- C-Sharp

here we subtract the two date start date and end date and store in a variavle in Number of Days Format
//First we extract the ate from data table and store in a variable

  string endt=dt.Rows[(dt.Rows.Count - 1)]["DATE_FIELD"].ToString() ;  //It gives the END Date in '14-May-2012' Format
  
  string stdt =dt.Rows[0]["DATE_FIELD"].ToString();   // //It gives the Start Date in '14-May-2012' Format 
                    
  int daydiff = 0;   // Initialize the variable

  // In the below case we subtract the date and store in a variavle in day format, like how many number of days
  daydiff = Convert.ToInt32( Convert.ToDateTime(endt).ToString("yyyyMMdd")) -Convert.ToInt32( Convert.ToDateTime(stdt).ToString("yyyyMMdd"));


Monday, 1 October 2012

SET DATE TIME FORMAT IN C#


using System;

class Program
{
    static void Main()
    {
 DateTime time = DateTime.Now;              // Use current time
 string format = "MMM ddd d HH:mm yyyy";    // Use this format
 Console.WriteLine(time.ToString(format));  // Write to console
    }
}

MMM display three-letter month ddd display three-letter day of the WEEK d display day of the MONTH HH display two-digit hours on 24-hour scale mm display two-digit minutes yyyy display four-digit year



 System.DateTime.Now.ToString("dd-MMM-yyyy HH:mm:ss")
Refrence: http://www.dotnetperls.com/datetime-format

Thursday, 27 September 2012

Make ReadOnly='True' in ASP.NET and value should be acceseble.


Some times we have seen that when we make the text box as read only the changed value of those text box is not accesseble but its visible.

so in that case we make the Fuction like below:

 void ReadOnlyTextBoxes()
    {
        txtFDate.Attributes.Add("readonly", "readonly");

    }

and call thsi fuction in

  protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {


    ReadOnlyTextBoxes();

}
    }

Wednesday, 19 September 2012

Not getting the Checkbox check value in gridviewbind using the gridview.


when ever you use gridviewbind the check value of check box is not coming in the page.

in that case we use the



 protected void Page_Load(object sender, EventArgs e)
    {
      if (!Page.IsPostBack)
       {
         gridviewbind();
       }
    }


The if (!Page.IsPostBack) use to remove this kind of issues

How to Create rar or zip file from Command Prompt

Go To Command prompt

change the full path of where rar is installed

Like CD C:\Program Files\WinRAR

then type

WinRAR> rar a <Name of the rar file.rar> <file to make rar>

Like  rar a C:\filename.rar  C:\filename.doc

then press Enter.