我想在每个月末检查相同的内容后为每个客户插入一行感兴趣的内容。 它适用于第一个但不适用于其余部分。我不知道怎么在这里使用'For..each'......:
任何帮助将不胜感激。
谢谢!
Dim Str(0) As String
Str(0) = GetID("Transactions", "ID")
Dim TempStr(5) As String
Try
Conn.Open()
Com.CommandText = "Select * From Customer"
Dr = Com.ExecuteReader
While Dr.Read()
TempStr(0) = Dr(0).ToString
TempStr(1) = Dr(2).ToString
TempStr(2) = Dr(3).ToString
TempStr(3) = Dr(5).ToString
TempStr(4) = Dr(6).ToString
TempStr(5) = Dr(7).ToString
Dim LastIntDate = DateAdd("m", 0, DateSerial(Year(Today), Month(Today), 0))
Try
Com.CommandText = "Select * From Transactions WHERE CID=" & TempStr(0).ToString & " AND TDate=#" & LastIntDate & "# AND Description='Interest'"
Dr2 = Com.ExecuteReader
If Dr2.Read = True Then
Dr2.Close()
Else
Try
Com.CommandText = "INSERT INTO Transactions Values(?,?,?,?,?,?,?)"
With Com.Parameters
.Add("@ID", OleDb.OleDbType.VarChar).Value = Str(0).ToString
.Add("@CustID", OleDb.OleDbType.VarChar).Value = TempStr(0).ToString
.Add("@TDate", OleDb.OleDbType.Date).Value = Date.Today
.Add("@Credit", OleDb.OleDbType.Currency).Value = 0
.Add("@Debit", OleDb.OleDbType.VarChar).Value = 500
.Add("@Balance", OleDb.OleDbType.VarChar).Value = Val(TempStr(3) + Interest)
.Add("@Desc", OleDb.OleDbType.VarChar).Value = "Interest"
End With
Com.ExecuteNonQuery()
Com.Parameters.Clear()
Catch ex As Exception
MsgBox(ex.Message)
End Try
Try
Com.CommandText = "Update Customer Set CurrBal=? WHERE ID=?"
With Com.Parameters
.Add("@CurrBal", OleDb.OleDbType.VarChar).Value = (TempStr(3) + Interest)
.Add("@CustID", OleDb.OleDbType.VarChar).Value = TempStr(0).ToString
End With
Com.ExecuteNonQuery()
Com.Parameters.Clear()
Catch ex As Exception
MsgBox(ex.Message)
End Try
End If
Dr2.Close()
Catch ex As Exception
End Try
End While
Dr.Close()
Catch ex As Exception
MsgBox(ex.Message)
End Try
Conn.Close()
答案 0 :(得分:0)
你很亲密。你不想 https://developers.facebook.com/docs/facebook-login/permissions#reference-manage_pages
而你是假的,你想读的是真的。通常它只是:
Dr.Read
它仅适用于第一位客户的原因是您只读取Do While Dr.Read()
中的第一条记录。除了不好的做法,做这样的事情:
Dr