Tag Archives: C#

How to extract data to Microsoft Excel Sheet from database

By | 23rd September 2017

  1.Declaration MX.Application xl = null; MX.Workbook wb = null; MX.Worksheet wsheet = null; xl = new MX.Application(); wb = Microsoft.Office.Interop.Excel.Workbook)(xl.Workbooks.Add(Missing.Value)); wb.Sheets.Add(Missing.Value, Missing.Value, Missing.Value, Missing.Value); wsheet = (Microsoft.Office.Interop.Excel.Worksheet)(wb.Sheets[1]); wsheet.Cells.Font.Name = “VERDANA”; wsheet.Cells.Font.Size = 9; wsheet.Cells.HorizontalAlignment = MX.XlHAlign.xlHAlignCenter; wsheet.get_Range(“A1”, “A1”).ColumnWidth = 9; wsheet.get_Range(“B1”, “B1”).ColumnWidth = 13; wsheet.get_Range(“C1”, “C1”).ColumnWidth = 28; wsheet.get_Range(“D1”, “D1”).ColumnWidth = 12; wsheet.Cells[4, 1]… Read More »

How to use insert query statement in Mysql

By | 13th September 2017

Insert query is used to add/insert the data values into the database tables. By executing the query the data easily inserts into the database. The below statement is how we actually insert the data values into the database.   cmd.CommandText = “insert into `databasename.tablename (field1,field2) values (‘1′,’abc’); cmd.Connection = con; cmd.ExecuteNonQuery(); How to use alter… Read More »

How to use BackgroundWorker in C#.Net

By | 9th September 2017

BackgroundWorker in C# is used to simplify threading. This object is designed to simply run a function on a different thread and then call an event on your UI thread when it’s complete.   Illustration code: 1. backgroundWorker1.RunWorkerAsync() :  Used to kickoff the worker thread to begin it’s DoWork function.       private void button1_Click(object sender, EventArgs… Read More »

How to get rid of Just-In-Time Debugger in Visual Studio 2012

By | 1st September 2017

Yesterday I faced a serious issue called Just-In-Time Debugger error, while running Microsoft .Net Application. I was trying hard to fix the issue. But after a series of attempts I just fixed it  by repairing the Visual studio 2012 exe.   Steps:   Go to: Control Panel Programs -> Uninstall a Program Programs and Features… Read More »