Pages

About Me

My photo
ForEach(Minute in MyLife) MyExperience ++;

Wednesday, September 12, 2012

http://www.macronimous.com/resources/stored_procedures_tips.asp

Tuesday, June 19, 2012

" M4Mahi " crossing 5000 hits ............. Thanks for all visitors and bloggers


Friday, March 23, 2012

What is a DTS package?

What is a DTS package?
A DTS package is a set of related objects (connections, tasks, and workflows) that can be used to access, transform and manipulate data from a wide range of sources including text files and relational databases. DTS was introduced with the release of SQL Server 7.0 and was carried across to SQL Server 2000 because of its immense popularity. ...(more)

Monday, February 13, 2012

Tuesday, December 20, 2011

MS word Automation

using System; 
using System.Collections.Generic; 
using System.ComponentModel; 
using System.Data; 
using System.Drawing; 
using System.Text; 
using System.Windows.Forms; 
using Microsoft.Office; 
using Microsoft.Office.Interop.Word; 
using Word = Microsoft.Office.Interop.Word; 
namespace CreditRequest 
    public partial class CreditRequest : Form 
    { 
        int iTotalFields = 0; 
        public CreditRequest() 
        { 
            InitializeComponent(); 
        } 
        private void btn_Generate_Click(object sender, EventArgs e) 
        { 
            Object oMissing = System.Reflection.Missing.Value; 
            Object oTrue = true
            Object oFalse = false
            Word.Application oWord = new Word.Application(); 
            Word.Document oWordDoc = new Word.Document(); 
            oWord.Visible = true
            Object oTemplatePath = "C:\\Template.dot"
            oWordDoc = oWord.Documents.Add(ref oTemplatePath, ref oMissing, ref oMissing, ref oMissing); 
            foreach (Word.Field myMergeField in oWordDoc.Fields) 
            { 
                iTotalFields++; 
                Word.Range rngFieldCode = myMergeField.Code; 
                String fieldText = rngFieldCode.Text; 
                if (fieldText.StartsWith(" MERGEFIELD")) 
                { 
                    Int32 endMerge = fieldText.IndexOf("\\"); 
                    Int32 fieldNameLength = fieldText.Length - endMerge; 
                    String fieldName = fieldText.Substring(11, endMerge - 11); 
                    fieldName = fieldName.Trim(); 
                    if (fieldName == "Name"
                    { 
                        myMergeField.Select(); 
                        oWord.Selection.TypeText(txt_CustName.Text); 
                    } 
                    if (fieldName == "Date"
                    { 
                        myMergeField.Select(); 
                        oWord.Selection.TypeText(dtp_CreditDate.Text); 
                    } 
                    if (fieldName == "Country"
                    { 
                        myMergeField.Select(); 
                        oWord.Selection.TypeText(txt_DestCountry.Text); 
                    } 

                } 
            } 
        } 
    } 
} Refer : http://social.msdn.microsoft.com/Forums/en-US/csharplanguage/thread/1a100644-da0f-482c-8042-339a8ff1658a