我正在尝试以编程方式使用 MailMerge(来自 C#)。我使用 Access 数据库文件作为数据源。Access 数据库有密码。以下代码由于某种原因不起作用,即使它应该起作用。我得到一个无效的密码文本框。
WordApp = new ApplicationClass();
WordApp.Visible = true;
adoc = WordApp.Documents.Open(ref Template,
ref Missing, ref Missing, ref Missing, ref Missing, ref Missing,
ref Missing, ref Missing, ref Missing, ref Missing, ref Missing,
ref Missing, ref Missing, ref Missing, ref Missing, ref Missing);
Object sql = "SELECT * FROM TestMergeTest";
Object conn = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" + @"C:\Documents and Settings\sebastianharko.AKA-OS\Desktop\See.mdb" + ";"
+ "Jet OLDEDB:Database Password=" + @"notpassword" + ";";
Object password = "notpassword";
adoc.MailMerge.OpenDataSource(@"C:\Documents and Settings\sebastianharko.AKA-OS\Desktop\See.mdb", ref Missing,
ref Missing, ref Missing, ref Missing, ref Missing,
ref Missing, ref Missing, ref Missing, ref Missing,ref Missing, ref conn, ref sql, ref Missing, ref Missing, ref Missing);
任何帮助将不胜感激。