Я использую vb6 для хранения данных в базе данных. Он хочет нормально работать до 150 записей (строка в базе данных), но после этого данные сохраняются из первой строки, и даже если я сортирую их в порядке возрастания, они не сортируются в сетке данных, и из-за этого у меня возникают проблемы при полученииномер для моего следующего заказа в форме меню (о моем проекте vb6).
Private Sub CmdDone_Click()
Dim a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, Y, z, aa, bb, cc, dd, ee, ff, gg, hh, ii, jj, kk As Integer
Dim ll, mm, nn, oo, pp, qq, rr, ss As Integer
Dim flag As Integer
flag = 0
Set db = OpenDatabase("D:\OrderMania\ordermania.mdb")
Set rs = db.OpenRecordset("select * from order1")
If rs.RecordCount > 0 Then
rs.MoveLast
GoTo 1
End If
1 If StrConv(TxtName.Text, vbProperCase) = "" Then
MsgBox ("Please Enter Your Name"), vbExclamation
TxtName.SetFocus
flag = 1
End If
If ComboTable.Text = "Select" Then
MsgBox ("Please Select The Table Number"), vbExclamation
ComboTable.SetFocus
flag = 1
Else
If Check1.Value = 1 Then
rs.AddNew
rs.Fields(7).Value = StrConv(TxtName.Text, vbProperCase)
rs.Fields(0).Value = TextOrNO.Text
rs.Fields(1).Value = ComboTable.Text
rs.Fields(6).Value = TxtDate.Text
rs.Fields(3).Value = UserControl1.Text
rs.Fields(2).Value = Check1.Caption
rs.Fields(4).Value = "20"
rs.Fields(5).Value = UserControl1.Text * 20
a = UserControl1.Text * 20
rs.Fields(8).Value = "Pending"
rs.Fields(9).Value = "Waiting"
rs.Update
End If
If Check2.Value = 1 Then
rs.AddNew
rs.Fields(7).Value = StrConv(TxtName.Text, vbProperCase)
rs.Fields(0).Value = TextOrNO.Text
rs.Fields(1).Value = ComboTable.Text
rs.Fields(6).Value = TxtDate.Text
rs.Fields(3).Value = UserControl2.Text
rs.Fields(2).Value = Check2.Caption
rs.Fields(4).Value = "15"
rs.Fields(5).Value = UserControl2.Text * 15
b = UserControl2.Text * 15
rs.Fields(8).Value = "Pending"
rs.Fields(9).Value = "Waiting"
rs.Update
End If
If Check3.Value = 1 Then
rs.AddNew
rs.Fields(7).Value = StrConv(TxtName.Text, vbProperCase)
rs.Fields(0).Value = TextOrNO.Text
rs.Fields(1).Value = ComboTable.Text
rs.Fields(3).Value = UserControl3.Text
rs.Fields(6).Value = TxtDate.Text
rs.Fields(2).Value = Check3.Caption
rs.Fields(4).Value = "12"
rs.Fields(5).Value = UserControl3.Text * 12
c = UserControl3.Text * 12
rs.Fields(8).Value = "Pending"
rs.Fields(9).Value = "Waiting"
rs.Update
End If
If Check4.Value = 1 Then
rs.AddNew
rs.Fields(7).Value = StrConv(TxtName.Text, vbProperCase)
rs.Fields(0).Value = TextOrNO.Text
rs.Fields(1).Value = ComboTable.Text
rs.Fields(3).Value = UserControl4.Text
rs.Fields(6).Value = TxtDate.Text
rs.Fields(2).Value = Check4.Caption
rs.Fields(4).Value = "20"
rs.Fields(5).Value = UserControl4.Text * 20
d = UserControl4.Text * 20
rs.Fields(8).Value = "Pending"
rs.Fields(9).Value = "Waiting"
rs.Update
End If
If Check5.Value = 1 Then
rs.AddNew
rs.Fields(7).Value = StrConv(TxtName.Text, vbProperCase)
rs.Fields(0).Value = TextOrNO.Text
rs.Fields(1).Value = ComboTable.Text
rs.Fields(3).Value = UserControl5.Text
rs.Fields(6).Value = TxtDate.Text
rs.Fields(2).Value = Check5.Caption
rs.Fields(4).Value = "20"
rs.Fields(5).Value = UserControl5.Text * 20
e = UserControl5.Text * 20
rs.Fields(8).Value = "Pending"
rs.Fields(9).Value = "Waiting"
rs.Update
End If
End If
TxtTotal.Text = a + b + c + d + e + f + g + h + i + j + k + l + m + n + o + p + q + r + s + t + u + v + w + x + Y + z + aa + bb + cc + dd + ee + ff + gg + hh + ii + jj + kk + ll + mm + nn + oo + pp + qq + rr + ss
Tot = CInt(TxtTotal.Text)
If flag = 0 Then
MsgBox "Your Order has been Placed", vbOKOnly, "Done"
End If
End Sub
Private Sub cmdBill_Click()
Dim Tot As Integer
Dim gst, gtot As Double
Tot = 0
Set db = OpenDatabase("D:\OrderMania\ordermania.mdb")
Set rs = db.OpenRecordset("select * from order1")
While Not rs.EOF
If StrConv(TxtName.Text, vbProperCase) = rs.Fields(7).Value And TextOrNO.Text = rs.Fields(0).Value Then
Form7.List1.AddItem (rs.Fields(2).Value)
Form7.List2.AddItem (rs.Fields(4).Value)
Form7.List3.AddItem (rs.Fields(3).Value)
Form7.List4.AddItem (rs.Fields(5).Value)
Form7.Text2.Text = rs.Fields(1).Value
Form7.Text7.Text = rs.Fields(6).Value
Tot = Tot + rs.Fields(5).Value
End If
rs.MoveNext
Wend
Form7.Text6.Text = Tot
gst = Tot * 0.05
Form7.Text5.Text = gst
gtot = Tot + gst
Form7.Text4.Text = gtot
Form7.Text3.Text = StrConv(TxtName.Text, vbProperCase)
Form7.Text1.Text = TextOrNO.Text
Form7.Show
Unload Me
End Sub
Private Sub Form_Activate()
TxtName.SetFocus
End Sub
Private Sub generateOID()
Dim db1 As Database
Dim rs1 As Recordset
Set db1 = OpenDatabase("D:\OrderMania\ordermania.mdb")
Set rs1 = db1.OpenRecordset("select * from order1")
If rs1.EOF = True Then
TextOrNO.Text = 1
Exit Sub
Else
rs1.MoveLast
TextOrNO.Text = rs1.Fields(0).Value + 1
End If
End Sub
Private Sub Form_Load()
Call generateOID
TxtName.Text = ""
ComboTable.Text = "Select"
TxtDate.Text = Date
lblTime.Caption = Time
TextOrNO.Enabled = False
End Sub