研究一下水晶报表的例子吧。
"C:\Program Files\Seagate Software\Crystal Reports\Samples\En\Code\Web\Active Server Pages"
下面是ttx内容,其中product id 和 product name是数据库的字段名
,product id 和 number是以tab分开的,string 和50也是。不能用空格分每一项的内容。Product ID Number
Product Name String 50

解决方案 »

  1.   

    供你參考:
    How to create a TTX file in Visual C++ using the CreateFieldDefFile functionThe information in the article refers to:
    Seagate Crystal Reports 8
     
     
    Applies to:
     
    Not tested with other versions
    Active Data
    Data Defintion File
    How to use CreateFieldDefFile in Visual C++
     SynopsisWhen reporting off of Active Data (ADO, DAO, RDO or CDO), it is often useful to create a Data Definition file (TTX file) using the CreateFieldDefFile function. A TTX file allows the report to be designed, even in the absence of the data the report is to report off of. There are several examples and samples of using CreateFieldDefFile in Visual Basic syntax, but how do you use this function in Visual C++?SolutionThe following Visual C++ code takes a recordset object and creates a TTX file using the CreateFieldDefFile function. Note: ======To ensure that Visual C++ can find P2smon.dll (the active data driver), the \system\ or \system32\ directory should be in the search path.===========// This enables the native COM interface in C++
    AfxOleInit();try {
    // Create your recordset here
    // Check for errors

    catch (_com_error& e) 
    {
    AfxMessageBox(e.ErrorMessage());
    }// CreateFieldDefFile takes an IUnknown**, char* and BOOL as arguments
    typedef UINT (CALLBACK* ULPRET) (LPUNKNOWN FAR * ,LPCSTR, BOOL);HINSTANCE hDLL; // Handle to DLL
    ULPRET lpfnDllFunc1; // Function pointer
    DWORD dwParam1;
    UINT uParam2, uReturnVal;// Load the p2smon.dll library
    hDLL = LoadLibrary("p2smon");// ensure that p2smon.dll did in fact load...
    if (hDLL != NULL)
    {
    // get the procedure address of CreateFieldDefFile 
    lpfnDllFunc1 = (ULPRET) GetProcAddress(hDLL, "CreateFieldDefFile");
    // make sure that the proc was located successfully
    if (!lpfnDllFunc1)
    {
       // handle the error
       FreeLibrary(hDLL); 
    }
    else
    {
       // cast the recordset as an IUnknown **
       if(!(*lpfnDllFunc1) ((IUnknown **)&pRecordSet, "c:\\samp.ttx", FALSE))
             AfxMessageBox("Error creating Field Definition File");
       }
    }Note:=====For information on using the CreateFieldDefFile function in Delphi, refer to kbase c2008737.For further information about Data Definition (TTX) files, go to www.crystaldecisions.com/docs and search for:
    ------------------------------------------------------
    SCR_TTXADO.PDF or SCR8_TTXADO.PDF(For Visual Basic)SCR_RDC_C++.PDF (For Visual C++)