views:

575

answers:

1

Is there an API call for Crystal Reports 8.5 that will generate a TTX schema file from a VB6 ADODB.Recordset at runtime, much in the same way you can generate an XSD from a DataSet in .NET? I could roll my own, and I think I probably will have to, but I don't want to reinvent the wheel because I missed something obvious.

+1  A: 

I'm afraid not. But a TTX file is a pretty simple format - just field name, type, length. You can loop through the Recordset's Field collection to create a string of the info required, and save it to a TTX file. I'm afraid I don't have Crystal or VB6 to hand so I can't give exact details, but something like this pseudocode :

Dim strTTX as String
Dim intI as Integer
With rst
    For intI = 0 to .Fields.Count - 1
     With .Fields(intI)
      strTTX = .Name & vbTab & FieldTypeDesc(.Type)
      If .Type = adChar Then
       strTTX = strTTX & vbtab & .Length
      End
      strTTX = strTTX & vbCrLf
     End With
    Next
End With
strTTX = Left$(strTTX, Len(strTTX) - 1) 'remove trailing vbCrLf

then add code to save that string as a TTX somewhere.

CodeByMoonlight
That's pretty much exactly what I figured I would wind up having to do; thanks.
Sepulchritude