We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Using sqlDataSource for merge


This should be simple: I create an sqlDataSource using the drag and drop tool in design mode; then, all I want to do is merge with the values from that data source.

Any ideas?



Can someone please answer this? The examples in the demos invent the field values as they go along…

Would it trouble anyone to answer this, especially those in charge of providing actual service?

The question was:

Simple SQL Server connection: How do you connect to a table on a server and use its data as the datasource for a merge?



Thanks for your request. Sorry for delay I had to work on other requests. You can try using the following code to achieve this.

//get results from SqlDataSource

DataView account = (DataView)SqlDataSource1.Select(new DataSourceSelectArguments());

//set name of table

account.Table.TableName = "Account";

//open template

Document doc = new Document(Server.MapPath("in.doc"));

//execute mailmerge


//save document


Here is my SqlDataSource

<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="server=web1;database=LS;uid=sa;pwd=password;" SelectCommand="SELECT * FROM [Account]"></asp:SqlDataSource>

My template looks like the following.



Point Rate

Month Rate





I hope that this will help you. Please let me know if you would like to know something else.

Best regards.

Thanks! I’ll try this right now!

Hey -- quick question:

Do you have all of the above in VB?

(Yes, I am annoying, but so are most people.)



Here is code in VB.

'get results from SqlDataSource

Dim account As Data.DataView = CType(SqlDataSource1.Select(New DataSourceSelectArguments()), Data.DataView)

'set name of table

account.Table.TableName = "Account"

'open template

Dim doc As Document = New Document(Server.MapPath("in.doc"))

'execute mailmerge


'save document


Best regards.

Thanks! And go figure, now you can post all your code in C# and have the users convert it themselves.

Pretty nifty, when you think about it.

Everything worked beautifully. Thank you for the quick responses and excuse my last-minute neurotic temperament.

You’re doing a great job there at Aspose.