Check If Field Name Exists In Db 关注

0
Avatar
Legacy Poster

is there a way to check if a field exists in the databas, in a script ?

 

we are using a TEXT file and first row as field names. but sometimes the field names are a bit different  (2 separate programs are using one label design, and producing the text file a bit different 

Yon

3 评论

0
Avatar
Ian Cummings
版主
评论操作 固定链接

This can be done externally to BarTender via one of the automation interfaces, but I'm not sure of a way to do this internally to BarTender via a VB script.  Sorry.  Anyone else got any ideas?

0
Avatar
Legacy Poster
评论操作 固定链接

How about reading in the first xx amount of bytes from the TEXT file to a string (the first row is the field names) and then see if that field is part of the string  

How would this be done in the VB script 

0
Avatar
Ian Cummings
版主
评论操作 固定链接

I guess that is feasible using the ReadLine method of the File System Object in VB script.  See the below example:

Function ReadLineTextFile
 Const ForReading = 1, ForWriting = 2
 Dim fso, MyFile   Set fso = CreateObject("Scripting.FileSystemObject")
 Set MyFile = fso.OpenTextFile("c:\testfile.txt", ForReading)
 ReadLineTextFile = MyFile.ReadLine
End Function

Note that BarTender has a full set of VB script documentation help found via the "Help" menu in BarTender.

请先登录再写评论。