jadams0173
Technical User
- Feb 18, 2005
- 1,210
I'm moving an app from vb6 to vb 2005. In vb6 I have this code.
It produces a text string that looks like this:
I've gotten the same thing in 2005 but it doesn't actually do anyting, but no errors are given. The loop is the same so I'm only posting the part that I'm having trouble with.
Also my connection is
2005 code
How can I make this work?
Code:
For x = .ListView1.LBound To .ListView1.UBound
For y = 1 To .ListView1(x).ListItems.Count
LVData(x_ary) = "Exec [dbo].[USP_Save_Data_Master_Scheduler] "
LVData(x_ary) = LVData(x_ary) & "'" & .ListView1(x).ListItems(y).ListSubItems(LVCols.eMO).Text & "'" '@mo
LVData(x_ary) = LVData(x_ary) & ",'" & .ListView1(x).ListItems(y).ListSubItems(LVCols.eItem).Text & "'" '@ITEM
LVData(x_ary) = LVData(x_ary) & ",'" & .ListView1(x).ListItems(y).ListSubItems(LVCols.eSchedDate).Text & "'" '@SCHED_DATE
LVData(x_ary) = LVData(x_ary) & "," & y '@PRIORITY
LVData(x_ary) = LVData(x_ary) & "," & .ListView1(x).ListItems(y).ListSubItems(LVCols.ePass).Text '@PASS
LVData(x_ary) = LVData(x_ary) & ",'" & .ListView1(x).ListItems(y).ListSubItems(LVCols.eComment).Text & "'" '@COMMENT
LVData(x_ary) = LVData(x_ary) & "," & .ListView1(x).ListItems(y).ListSubItems(LVCols.eSchedQty).Text '@SCHED_QTY
LVData(x_ary) = LVData(x_ary) & "," & .ListView1(x).ListItems(y).ListSubItems(LVCols.eAction).Text '@ACTION
LVData(x_ary) = LVData(x_ary) & "," & .ListView1(x).ListItems(y).ListSubItems(LVCols.eSchedLine).Text '@SCHED_LINE
LVData(x_ary) = LVData(x_ary) & ",'" & .ListView1(x).ListItems(y).ListSubItems(LVCols.eOtherSide).Text & "'" '@OTHER_SIDE
LVData(x_ary) = LVData(x_ary) & "," & .ListView1(x).ListItems(y).ListSubItems(OldRel).Text
x_ary = x_ary + 1
'Debug.Print LVData(x_ary)
Next y
Next x
End With
'Debug.Print Join(LVData, vbCrLf)
clOpenConn.clOpenConnSQL.Execute (Join(LVData, vbCrLf))
It produces a text string that looks like this:
Code:
Exec [dbo].[USP_Save] '3009','80532','11/2/2009',14,0,'',5,-1,9,'N-A',0
I've gotten the same thing in 2005 but it doesn't actually do anyting, but no errors are given. The loop is the same so I'm only posting the part that I'm having trouble with.
Also my connection is
Code:
Public clOpenConnSQL As New SqlClient.SqlConnection
Code:
cmd = New SqlClient.SqlCommand(String.Join(Environment.NewLine, aryLV), clOpenConn.clOpenConnSQL)
cmd.ExecuteNonQuery()
How can I make this work?