Microsoft Office Tutorials and References
In Depth Information
Creating a Ribbon menu for Outlook 2007
3. Let's write a program to establish effective communication with the Microsoft
SQL Server 2008 database table, and import the information to Outlook
2007's contact folder, by using the C# programming language and VSTO.
private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
// Instantiated datatable, used to read the loaded data
DataTable PacktDataTable = new DataTable();
// Opening SQL connection for Microsoft SQL Server 2008
SqlConnection PacktSQLConnection = new SqlConnection(@"Data
Source=WINNER;Initial Catalog=PacktPub;Integrated
Security=True");
// Passing SQL command text and SQL connection information
SqlCommand PacktSQLCommand = new SqlCommand("SELECT * FROM
Contacts", PacktSQLConnection);
// Open the SQL connection through Open method
PacktSQLConnection.Open();
// SQL reader to read through data from Database
SqlDataReader PacktSQLReader = PacktSQLCommand.
ExecuteReader(CommandBehavior.CloseConnection);
// Load the read data to datatable
PacktDataTable.Load(PacktSQLReader);
// Now close the datareader
PacktSQLReader.Close();
// Get the contact folder loaded using MAPIFolder object
 
Search JabSto ::




Custom Search