novichok_sis » 17.12.2007 (Пн) 8:45
Вот полный код. Нужно подсчитать сумму значений 3-го столбца начиная с 5-ой строки?
Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim app As New Excel.Application
Dim wb As Excel.Workbook
Dim ws As Excel.Worksheet
wb = app.Workbooks.Add
ws = wb.Worksheets(1)
Dim commIP As New OracleCommand("select name_r, sum(minuts) SUMMM, round(sum(price_$/nds_$),2) SUMMB_WNDS, sum(price_$) SUMMB " & _
"from bis.table1 " & _
"where date>=:START_DATE " & _
"and date<=to_date(:END_DATE)+1 " & _
"group by name_r " & _
"order by name_r", conn)
commIP.CommandType = CommandType.Text
Dim ps, pe As New OracleClient.OracleParameter
ps.ParameterName = ":START_DATE"
ps.Direction = ParameterDirection.Input
ps.OracleType = OracleType.DateTime
ps.Value = DTP1.Text
commIP.Parameters.Add(ps)
pe.ParameterName = ":END_DATE"
pe.Direction = ParameterDirection.Input
pe.OracleType = OracleType.DateTime
pe.Value = DTP2.Text
commIP.Parameters.Add(pe)
Dim dr As OracleDataReader
dr = commIP.ExecuteReader
Dim i As Integer
i = 5
While dr.Read
ws.Cells(i, 2) = dr("name_r")
ws.Cells(i, 3) = dr("SUMMM")-Нужно подсцитать сумму этого столбца???
ws.Cells(i, 4) = dr("SUMMB_WNDS")
ws.Cells(i, 5) = dr("SUMMB")
End While
dr.Close()
app.Visible = True
End Sub