We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

DocIO Mail merge with Oracle database

Hello,

I have an Oracle database and I would like to use DocIO to fill the customers fields in a letter from a table of that database. How can i do that with Oracle?

Thanks


3 Replies

PR Poornima R Syncfusion Team November 4, 2011 12:44 PM UTC

Hi Horst,

Thank you for your interest in Syncfusion Products.

Regarding your query “Using Oracle data base in mail merging”:
Please try using the following two steps to use oracle database in mail merge
1) Initially oracle database should be connected to the client application. Once the data base is connected the required table needs to be populated in the DataSet. Please find the following code snippet illustrating the same

//Create an instance for oracle connection
OracleConnection conn = new OracleConnection();
//Set connection string
conn.ConnectionString = "Data Source=" + ";Integrated Security=yes";
//Open connection
conn.Open();
//Create oracle command
OracleCommand command = new OracleCommand("Select * from Employees", conn);
//Create an instance for dataset
DataSet ds = new DataSet();
//Create oracle data adapter
OracleDataAdapter oraDa = new OracleDataAdapter(command);
//Fill dataset
oraDa.Fill(ds, "TableName");

2) Once the data set is populated using the above code, mail merging can be performed in DocIO using the populated data set as in the below code

// Creating a new document.
WordDocument document = new WordDocument();
// Load template
document.Open("Input.doc", FormatType.Doc);

// Execute Mail Merge with groups.
document.MailMerge.ExecuteGroup(ds.Tables["TableName"]);
// Saving the document to disk.
document.Save("output.doc",FormatType.Doc );

To know more about mail merging, please refer the below online documentation and UG link

Online documentation link:
http://help.syncfusion.com/ug_94/Reporting/DocIO/ASP.NET/default.htm?turl=Documents%2F46mailmerge.htm

Online sample link:
http://asp.syncfusion.com/sfaspnetsamplebrowser/9.4.0.62/Web/DocIO.Web/Samples/4.0/Mail%20Merge/LetterFormatting/CS/LetterFormatting.aspx

http://asp.syncfusion.com/sfaspnetsamplebrowser/9.4.0.62/Web/DocIO.Web/Samples/4.0/Mail%20Merge/EmployeeReport/CS/EmployeeReport.aspx

http://asp.syncfusion.com/sfaspnetsamplebrowser/9.4.0.62/Web/DocIO.Web/Samples/4.0/Mail%20Merge/Mail%20Merge%20Event/CS/Mailmerge_Event.aspx

http://asp.syncfusion.com/sfaspnetsamplebrowser/9.4.0.62/Web/DocIO.Web/Samples/4.0/Mail%20Merge/NestedMailMerge/CS/NestedMailMerge.aspx

Please let us know if you have any questions.
Regards,
Poornima






WT W. ter Horst November 7, 2011 08:24 PM UTC

Thanks for the reply,

I have some views can I use a view to merge data in a letter?



GT Gunasekaran T Syncfusion Team November 10, 2011 09:07 AM UTC

Hi Horst,

Thank you for your update.

Yes, you can use view to merge data using mail merge functionality of DocIO. For merging the data from the Views please use the SQL command mentioned below.

SQL command to merge data from Views:
SELECT * FROM

Example: SELECT * FROM EmployeesView.
EmployeesView is the view created for the table Employees.

Please let me know if you have any queries.

Regards,
Gunasekaran




Loader.
Live Chat Icon For mobile
Up arrow icon