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?