Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Mailmerge and Fax / July 2006

Tip: Looking for answers? Try searching our database.

MailMerge OpenDataSource SSPI direct SQL Server connection

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Thomas - 10 Jul 2006 08:26 GMT
Hello,
my problem is, that I can't get my OpenDataSource code working well.
Word opens another dialog where to choose a DataSource manual. Anyone
an idea what I do wrong? I need SSPI connection...

string table = "Userlist";
object cString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist
Security Info=True;Initial Catalog=KUMAgroup_MSCRM;Data
Source=KGRMACRM1;Use Procedure for Prepare=1;Auto Translate=1;Packet
Size=4096";
object sqlString = "SELECT * FROM [" + table + "]";

doc.MailMerge.OpenDataSource("", ref oMissing, ref oMissing, ref oTrue,
ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref
oMissing,ref oMissing, ref oMissing, ref cString, ref sqlString, ref
oMissing, ref oFalse, ref oMissing);
Peter Jamieson - 10 Jul 2006 10:29 GMT
To open a SQL Server connection using OLEDB, you have to have a .udl or .odc
file, even when you have provided all the necessary connection details in
cString. However, the .odc file (which is just a text file) can be an empty
file created in Notepad.

Peter Jamieson
> Hello,
> my problem is, that I can't get my OpenDataSource code working well.
[quoted text clipped - 12 lines]
> oMissing,ref oMissing, ref oMissing, ref cString, ref sqlString, ref
> oMissing, ref oFalse, ref oMissing);
Thomas - 10 Jul 2006 13:35 GMT
Hello Peter,

> To open a SQL Server connection using OLEDB, you have to have a .udl or .odc
> file, even when you have provided all the necessary connection details in
> cString. However, the .odc file (which is just a text file) can be an empty
> file created in Notepad.

Thx, now it work, but the connection needs much time to connect the
server. The manual way it's fast but with the programmatic
ConnectionString it's slow. Any idea?
Peter Jamieson - 10 Jul 2006 14:30 GMT
> The manual way it's fast but with the programmatic
> ConnectionString it's slow. Any idea?

Sorry, I don't know what could be causing that. The connection strings I use
here have similar settings to yours, and performance is OK. Leaving things
out such as the Merge subtype the parameter after "SQLStatement2" does not
seem to make much difference. But I am working in quite a benign environment
here.

You aren't using SQL Server 2005 are you? If so, you should probably try
using the new client OLEDB provider SQLNCLI.1. However, I don't see why it
would make a significant difference to performance.

Peter Jamieson

> Hello Peter,
>
[quoted text clipped - 8 lines]
> server. The manual way it's fast but with the programmatic
> ConnectionString it's slow. Any idea?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.