 |
|
ถามเรื่องการวนลูป while หน่อยคับ คือ ต้องการรวมค่าใน DataBase จึงใช้คำสั่ง while แล้วโปรแกรมกลับ วน 4 รอบ |
|
 |
|
|
 |
 |
|
คือ Code ข้างบนมันใส่ผิดคับ
Code (VB.NET)
Dim StrConn As String
Dim Sql As String
StrConn = WebConfigurationManager.ConnectionStrings("conn").ConnectionString
Dim Conn As New SqlConnection(StrConn)
Conn.Open()
Dim a, b, c, d, f, g, h, i As Integer
Sql = "SELECT * FROM Dtac_sale where month(Dtac_sale.date_now)= " & Month.Text & " AND year(Dtac_sale.date_now)= " & Year.Text & " "
Dim sqlCom As New SqlCommand(Sql, Conn)
Dim dr As SqlDataReader = sqlCom.ExecuteReader
While dr.Read
a = dr.Item("sale_60")
b = dr.Item("sale_100")
c = dr.Item("sale_200")
d = dr.Item("sale_300")
f = dr.Item("back_60")
g = dr.Item("back_100")
h = dr.Item("back_200")
i = dr.Item("back_300")
Response.Write(a)
Response.Write("<br>")
Session("z") = Session("z") + a
Session("y") = Session("y") + b
Session("x") = Session("x") + c
Session("w") = Session("w") + d
Session("v") = Session("v") + f
Session("u") = Session("u") + g
Session("t") = Session("t") + h
Session("s") = Session("s") + i
End While
ช่วยแนะนำทีคับบบ
|
 |
 |
 |
 |
Date :
2009-06-03 15:10:01 |
By :
hero_big |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
แล้วข้อมูลทั้งหมดมีเท่าไร(กี่ row)ครับ งง อิอิ คือต้องวนรอบเดียวใช่ไหมครับ
|
 |
 |
 |
 |
Date :
2009-06-03 22:02:44 |
By :
besttooo |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|