Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Thomas Thomas is offline
external usenet poster
 
Posts: 2
Default MailMerge OpenDataSource SSPI direct SQL Server connection

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);

  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default MailMerge OpenDataSource SSPI direct SQL Server connection

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
"Thomas" wrote in message
ups.com...
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);



  #3   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Thomas Thomas is offline
external usenet poster
 
Posts: 2
Default MailMerge OpenDataSource SSPI direct SQL Server connection

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?

  #4   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default MailMerge OpenDataSource SSPI direct SQL Server connection

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

"Thomas" wrote in message
oups.com...
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?



Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
mailmerge from access database using DDE connection? Mike Mailmerge 3 January 11th 06 09:00 PM
Connecting to SQL Server for mailmerge [email protected] Mailmerge 4 June 2nd 05 07:18 AM
directly connecting the MailMerge object to MS SQL server Gerhard Kiessling Mailmerge 1 May 25th 05 05:01 PM
Using an .odc File to Mailmerge with SQL Server Adam Froio Mailmerge 3 February 10th 05 06:06 PM
Mailmerge Recipients doesn't work with SQL Server Gelatinous_Blob Mailmerge 2 December 17th 04 05:34 PM


All times are GMT +1. The time now is 06:48 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"