Wednesday, September 11, 2013

load log *.txt file in asp.net page using jquery

 

  $('
').load('mytextFile.txt', function (textStr) {
            var htmlStr = $(this).html(textStr).text();
            $(this).html(htmlStr);
        }).appendTo('form');



Tuesday, September 10, 2013

ask for saving new records once clicked on submit



    Untitled Page
   
   

   

   

       
       

       
           
           
           
           
       

       

       
   

   

protected void btnsubmit_Click(object sender, EventArgs e)
        {
            Response.Write("button_clicked");
            string str = "Are you sure, you want to Approve this Record?";
            this.ClientScript.RegisterStartupScript(typeof(Page), "Popup", "ConfirmApproval('" + str + "');", true);
        } 


       
       

       
           
           
           
           
       

       

       
   
 

  function ConfirmApproval(objMsg) {
            if (confirm(objMsg)) {
                $('.txtCheck').attr('disabled', 'disabled');
                $('.ddlCheck').attr('disabled', 'disabled');
                return true;
            }
            else {
                alert("redirected");
                return false;
            }
        } 

Monday, September 9, 2013

best comment in source code

// 
// Dear maintainer:
// 
// Once you are done trying to 'optimize' this routine,
// and have realized what a terrible mistake that was,
// please increment the following counter as a warning
// to the next guy:
// 
// total_hours_wasted_here = 42
// 


//When I wrote this, only God and I understood what I was doing
//Now, God only knows

http://stackoverflow.com/questions/184618/what-is-the-best-comment-in-source-code-you-have-ever-encountered

Sunday, September 8, 2013

why make self as this reference in knockout.js

Import Data using INFILE in mysql

LOAD DATA local INFILE 'E://31october//SP//sp_files_sample1//400k sp00 6-19 E.csv'
INTO TABLE  tblspmaster
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
ESCAPED BY '\\'
LINES TERMINATED BY '\n'
IGNORE 1 LINES
(sp);

Export data using outfile in mysql

SELECT *
INTO OUTFILE 'E:\31october\SP\Export\10000000.csv'
FIELDS
  TERMINATED BY ','
  OPTIONALLY ENCLOSED BY '"'
  ESCAPED BY '\\'
  LINES TERMINATED BY '\n'
FROM tblspmaster
WHERE CSN BETWEEN 0 AND 10000000


Wednesday, August 14, 2013

How to read excel file data into datatable in c# to store in db

 protected void Page_Load(object sender, EventArgs e)
    {
       DataTable dt=  ReadExcelToTable("E:\\31october\\Excel\\Files\\empdata.xlsx");
    }
 
 
 
 
private DataTable ReadExcelToTable(string path)    
 {

     //Connection String

     string connstring = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + path + ";Extended Properties='Excel 8.0;HDR=NO;IMEX=1';";  
     //the same name 
     //string connstring = Provider=Microsoft.JET.OLEDB.4.0;Data Source=" + path + //";Extended Properties='Excel 8.0;HDR=NO;IMEX=1';"; 

     using(OleDbConnection conn = new OleDbConnection(connstring))
     {
        conn.Open();
        //Get All Sheets Name
        DataTable sheetsName = conn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables,new object[]{null,null,null,"Table"});  

        //Get the First Sheet Name
        string firstSheetName = sheetsName.Rows[0][2].ToString(); 

        //Query String 
        string sql = string.Format("SELECT * FROM [{0}]",firstSheetName); 
        OleDbDataAdapter ada =new OleDbDataAdapter(sql,connstring);
        DataSet set = new DataSet();
        ada.Fill(set);
        return set.Tables[0];   
   }
 }

.net core

 Sure, here are 50 .NET Core architect interview questions along with answers: 1. **What is .NET Core, and how does it differ from the tradi...