Announcement

Collapse
No announcement yet.

WinWord ODBC - Connect mit C#

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • WinWord ODBC - Connect mit C#

    Hallo zusammen,
    ich bin am verzweifeln...
    Ich versuche mit C# ein Seriendruck zu steueren und scheitere am OpenDataSource.
    Ich bin dankbar für jede Anregung.
    Hier ein Ausschnitt aus meinem Programm:

    <PRE>
    using Word;
    ...

    private Application WinWordApp;

    WinWordApp = new Application();

    WinWordApp.Visible=true;
    object template = Missing.Value;
    object newTemplate = Missing.Value;
    object documentType = Missing.Value;
    object visible=true;
    _Document doc = WinWordApp.Documents.Add(ref template, ref newTemplate, ref documentType, ref visible);

    //ODBC-Connect aufbauen
    object name = "";
    object connection = "ODBC;DSN=Northwind;UID=sa;PWD=;";
    object sqlstatement = "SELECT * FROM Employees";
    object optional = Missing.Value;

    try
    {

    WinWordApp.ActiveDocument.MailMerge.OpenDataSource (
    "", // System.String Name ,
    ref optional, // System.Object Format ,
    ref optional, // System.Object ConfirmConversions ,
    ref optional, // System.Object ReadOnly ,
    ref optional, // System.Object LinkToSource ,
    ref optional, // System.Object AddToRecentFiles ,
    ref optional, // System.Object PasswordDocument ,
    ref optional, // System.Object PasswordTemplate ,
    ref optional, // System.Object Revert ,
    ref optional, // System.Object WritePasswordDocument ,
    ref optional, // System.Object WritePasswordTemplate ,
    ref connection, // System.Object Connection ,
    ref sqlstatement, // System.Object SQLStatement ,
    ref optional, // System.Object SQLStatement1 ,
    ref optional, // System.Object OpenExclusive ,
    ref optional); // System.Object SubType )
    }
    catch (System.Runtime.InteropServices.COMException e)
    {
    System.Windows.Forms.MessageBox.Show("Fehler beim ODBC-Connect: " + e.Message);
    }
    </PRE>

  • #2
    Hallo Konrad,

    bist du bei deinem Problem schon weitergekommen? Ich steh soll auch mit C# Serienbriefe erstellen, bzw. Drucken, aber ich bin ein C# Frischling und weiß noch nichtmal wie ich da anfangen soll. Kannst du mir vielleicht ein paar Tips geben?

    Gruß

    And

    Comment

    Working...
    X