Results 1 to 5 of 5

Thread: [RESOLVED] Could this be more efficient?

Threaded View

  1. #1

    Thread Starter
    Member red_bull_n_vodka's Avatar
    Join Date
    Jun 2005
    Posts
    32

    [RESOLVED] Could this be more efficient?

    I tried bringing the open and close statements out, but then it doesnt get myOdbcCommand. Is there a more efficient way to write this? This ran for 45 minutes before thowing an error. It got though most of the tables.

    VB Code:
    1. For iTable = 1 To 12
    2.         For iCounter = 0 To (ds.Tables(0).Rows.Count - 1)
    3.             If (ds.Tables(0).Rows(iCounter).Item("U_GAS_SERV") <> 0) Then
    4.                 iGasServ = ds.Tables(0).Rows(iCounter).Item("U_GAS_SERV")
    5.                 Dim myDeleteStatement As String = "DELETE * FROM GSV00" & iTable & "T WHERE GSV001T.U_GAS_SERV = " & iGasServ
    6.                 Dim myOdbcCommand As New OdbcCommand(myDeleteStatement, gsvConnection)
    7.                 'Opens the db connection
    8.                 gsvConnection.Open()
    9.                 'Excutes the delete statement
    10.                 myOdbcCommand.ExecuteNonQuery()
    11.                 'Closes connection
    12.                 myOdbcCommand.Connection.Close()
    13.             End If
    14.         Next
    15.         MessageBox.Show("Done with " & iTable)
    16.         Next
    Last edited by red_bull_n_vodka; Jul 15th, 2005 at 02:40 PM.
    I am a rookie @ this...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width