eramgarden
Programmer
I've inherited a small VB6 app. It uses "stream" object (but not sure) to convert text field to varchar.
I want to upgrade this VB6 app to C# and wondering if there's a way in to do the same
This is some of the code ex-developer has:
============
'Add to stream
xSQLtrans2.stmGen1.Type = adTypeText
xSQLtrans2.stmGen1.Charset = "us-ascii"
If xSQLtrans2.stmGen1.Size < 204 Then
xSQLtrans2.stmGen1.Position = xSQLtrans2.stmGen1.Size
Else
xSQLtrans2.stmGen1.Position = 204
End If
vtrRst = xSQLtrans2.stmGen1.ReadText
'Remove Quotes
If InStr(1, vtrRst, Chr(39)) > 0 Or InStr(1, vtrRst, Chr(34)) Then
For Lcounter = 1 To Len(vtrRst)
If Mid$(vtrRst, Lcounter, 1) = Chr(39) Or Mid$(vtrRst, Lcounter, 1) = Chr(34) Then
Mid(vtrRst, Lcounter, 1) = "^"
End If
Next
End If
vtrRst = Trim$(vtrRst)
frmAdmin.Text1.Text = vtrRst
vtrRst = Mid$(vtrRst, 1, Len(frmAdmin.Text1.Text))
vtrRst = Replace(vtrRst, Chr$(15), Chr$(32))
I want to upgrade this VB6 app to C# and wondering if there's a way in to do the same
This is some of the code ex-developer has:
============
'Add to stream
xSQLtrans2.stmGen1.Type = adTypeText
xSQLtrans2.stmGen1.Charset = "us-ascii"
If xSQLtrans2.stmGen1.Size < 204 Then
xSQLtrans2.stmGen1.Position = xSQLtrans2.stmGen1.Size
Else
xSQLtrans2.stmGen1.Position = 204
End If
vtrRst = xSQLtrans2.stmGen1.ReadText
'Remove Quotes
If InStr(1, vtrRst, Chr(39)) > 0 Or InStr(1, vtrRst, Chr(34)) Then
For Lcounter = 1 To Len(vtrRst)
If Mid$(vtrRst, Lcounter, 1) = Chr(39) Or Mid$(vtrRst, Lcounter, 1) = Chr(34) Then
Mid(vtrRst, Lcounter, 1) = "^"
End If
Next
End If
vtrRst = Trim$(vtrRst)
frmAdmin.Text1.Text = vtrRst
vtrRst = Mid$(vtrRst, 1, Len(frmAdmin.Text1.Text))
vtrRst = Replace(vtrRst, Chr$(15), Chr$(32))