Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Try
- For i As Integer = 0 To dt_data.RowCount - 3
- Dim meter_number As String
- meter_number = dt_data.Rows(i).Cells(3).Value
- Dim query As String = "Select * from customer where meter_num = @meter_num ORDER BY actrdngdt ASC"
- conn.Open()
- Dim command As New SqlCommand(query, conn)
- command.Parameters.AddWithValue("@meter_num", meter_number)
- Dim da As New SqlDataAdapter(command)
- Dim ds As New DataSet
- If i = dt_data.RowCount - 3 Then
- da.Fill(ds, "customer")
- dt_sample.DataSource = ds.Tables(0)
- End If
- conn.Close()
- Next
- Catch ex As SqlException
- MsgBox(ex.Message, MsgBoxStyle.Critical, "SQL Error")
- Catch ex As Exception
- MsgBox(ex.Message, MsgBoxStyle.Critical, "General Error")
- 'End Try
- 'Catch ex As Exception
- 'MessageBox.Show(String.Format("Error: {0}", ex.Message), "Error", MessageBoxButtons.OKCancel, MessageBoxIcon.Error)
- End Try
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement