m.4.r.m
یک شنبه 03 دی 1391, 11:01 صبح
سلام من چندی پیش این کد رو نوشته بودم تو یه برنامم با پایگاه داده SQL :
اضافه کردن به Vsflexgrid :
If txtname.Text <> "" Then
With VSFlexGrid1
If (.TextMatrix(.Rows - 1, 2) <> txtprid.Text) And (cont.Value > 0) Then
.Rows = .Rows + 1
.TextMatrix(.Rows - 1, 1) = txtid.Text
.TextMatrix(.Rows - 1, 2) = txtprid.Text
.TextMatrix(.Rows - 1, 3) = txtprname.Text
.TextMatrix(.Rows - 1, 4) = cont.Value
Else
MsgBox "ÎØÇíí ÑÎ ÏÇÏå ÇÓÊ :" & vbCrLf & "1- ãÍÕæá ãæÑÏ äÙÑ Ê˜ÑÇÑí ÇÓÊ" & vbCrLf & "2- ÊÚÏÇÏ ãÍÕæá ÍÏÇÞá ÈÇíÏ 1 ÈÇÔÏ" _
, vbCritical + vbMsgBoxRight + vbMsgBoxRtlReading, ""
End If
End With
Else
MsgBox "áØÝÇ ØÑÝ ÍÓÇÈ ÑÇ ãÔÎÕ äãÇÆíÏ", vbExclamation, ""
End If
اینم کد ذخیره کردن :
Adodc2.RecordSource = "Select * from Sale2"
Adodc2.Refresh
Dim i
With VSFlexGrid1
If .Rows = 1 Then Beep: Exit Sub
For i = 1 To .Rows - 1
Adodc2.Recordset.AddNew Array("SaleID", "ProductID", "ProductName", "Count"), Array(.TextMatrix(i, 1), .TextMatrix(i, 2), .TextMatrix(i, 3), .TextMatrix(i, 4))
Adodc2.Recordset.Update
Next i
MsgBox "ÝÇ˜ÊæÑ ÝÑæÔ ÈÇ ãæÝÞíÊ ËÈÊ ÔÏ", vbInformation + vbMsgBoxRtlReading, ""
'.Rows = 1
txtid.Text = txtid + 1
End With
حالا همین کد تو پایگاه داده اکسس خطا میده و قبول نمی کنه اینم خطا :
Multiple-Step Operation Generate Error check each status value
چیکار کنم ؟
اضافه کردن به Vsflexgrid :
If txtname.Text <> "" Then
With VSFlexGrid1
If (.TextMatrix(.Rows - 1, 2) <> txtprid.Text) And (cont.Value > 0) Then
.Rows = .Rows + 1
.TextMatrix(.Rows - 1, 1) = txtid.Text
.TextMatrix(.Rows - 1, 2) = txtprid.Text
.TextMatrix(.Rows - 1, 3) = txtprname.Text
.TextMatrix(.Rows - 1, 4) = cont.Value
Else
MsgBox "ÎØÇíí ÑÎ ÏÇÏå ÇÓÊ :" & vbCrLf & "1- ãÍÕæá ãæÑÏ äÙÑ Ê˜ÑÇÑí ÇÓÊ" & vbCrLf & "2- ÊÚÏÇÏ ãÍÕæá ÍÏÇÞá ÈÇíÏ 1 ÈÇÔÏ" _
, vbCritical + vbMsgBoxRight + vbMsgBoxRtlReading, ""
End If
End With
Else
MsgBox "áØÝÇ ØÑÝ ÍÓÇÈ ÑÇ ãÔÎÕ äãÇÆíÏ", vbExclamation, ""
End If
اینم کد ذخیره کردن :
Adodc2.RecordSource = "Select * from Sale2"
Adodc2.Refresh
Dim i
With VSFlexGrid1
If .Rows = 1 Then Beep: Exit Sub
For i = 1 To .Rows - 1
Adodc2.Recordset.AddNew Array("SaleID", "ProductID", "ProductName", "Count"), Array(.TextMatrix(i, 1), .TextMatrix(i, 2), .TextMatrix(i, 3), .TextMatrix(i, 4))
Adodc2.Recordset.Update
Next i
MsgBox "ÝÇ˜ÊæÑ ÝÑæÔ ÈÇ ãæÝÞíÊ ËÈÊ ÔÏ", vbInformation + vbMsgBoxRtlReading, ""
'.Rows = 1
txtid.Text = txtid + 1
End With
حالا همین کد تو پایگاه داده اکسس خطا میده و قبول نمی کنه اینم خطا :
Multiple-Step Operation Generate Error check each status value
چیکار کنم ؟