| Register | FAQ | Calendar | Search | Today's Posts | Mark Forums Read |
|
#1
| |||
| |||
| Hello, I have a view in Informix, the last column which is a 500 char long TEXT field stored in the db as a blob. Firstly my code brings accross all the other data fields EXCEPT the final column. To further add to my "issues" this final column also contains Nulls. I have read through the posts on nulls and blobs but vb being new to me much of it not making a great deal of sense. Can someone point me the right direction ? Below is the code I am using, this was written by someone else and I have just amended it where nesacary. Public ConPick As New ADODB.Connection Public RSPick As New ADODB.Recordset Private Sub btnAll_Click() btnConnect_Click btnExport_Click btnDiscontect_Click Unload Me End Sub Private Sub btnConnect_Click() 'MsgBox "Create connection to INFORMIX" Dim ConStringPick As String Dim SQLStringPick 'Code to connect to INFORMIX ConStringPick = "DSN=Infocentre_INFO8" SQLStringPick = "Select pms_ord_no,ea_ord_no,ea_ord_itm,due_dt,expt_dt,shi pped,instructions From v654_vpms04_v1_4" ConPick.Open ConStringPick RSPick.Open SQLStringPick, ConPick, adOpenDynamic, adLockOptimistic 'MsgBox "Conected to Informix" End Sub Private Sub btnDiscontect_Click() RSPick.Close ConPick.Close 'MsgBox "Closed Connection to Informix" End Sub Private Sub btnExport_Click() Dim iTotalRecords As Integer Dim sFileToExport As String Dim iFileNum As Integer Dim iIndx As Integer Dim iNumberOfFields As Integer Dim fileName As String fileName = "x:\pms_file1.txt" '----------------------------------------------------------------- '-------- EXPORT TO CSV ------------------------------------------ '----------------------------------------------------------------- iTotalRecords = 0 sFileToExport = fileName iFileNum = FreeFile() Open sFileToExport For Output As #iFileNum ' Open file for output. '------------------------- '-- Stream out the data -- '------------------------- iNumberOfFields = RSPick.Fields.Count - 1 RSPick.MoveFirst Do Until RSPick.EOF iTotalRecords = iTotalRecords + 1 For iIndx = 0 To iNumberOfFields If (IsNull(RSPick.Fields(iIndx))) Then Print #iFileNum, " ,"; 'simply a comma delimited string ElseIf RSPick.Fields(iIndx) = " " Then Print #iFileNum, " ,"; 'simply a comma delimited string ElseIf RSPick.Fields(iIndx) = " " Then Print #iFileNum, " ,"; 'simply a comma delimited string Else If iIndx = iNumberOfFields Then Print #iFileNum, Trim$(CStr(RSPick.Fields(iIndx))); Else Print #iFileNum, Trim$(CStr(RSPick.Fields(iIndx))); ","; End If End If Next Print #iFileNum, RSPick.MoveNext DoEvents Loop 'MsgBox "Exported Data to X drive" End Sub Private Sub Form_Load() If Command() = "/ run" Then Call btnAll_Click End If End Sub |
![]() |
| Thread Tools | |
| Display Modes | |
In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.