cn2.Open "dsn=xx;uid=user;pwd=123"
cn2.CursorLocation = adUseClient
cn2.BeginTrans
cn2.Execute (str2)
If Err Then
if err then
MsgBox "单据明细保存失败" + Err.Description
cn2.RollbackTrans
saveinfo.Caption = "请重新输入单据明细"
Else
cn2.CommitTrans
MsgBox "单据明细保存成功"
saveinfo.Caption = ""
rs1.Open "select * from ck_prod_his where oddno='" & Trim(Text4.Text) & "' ", cn2, adOpenStatic
Set DataGrid1.DataSource = rs1
End If
cn2.Close
Set cn2 = Nothing
End Sub
cn2.CursorLocation = adUseClient
cn2.BeginTrans
cn2.Execute (str2)
If Err Then
if err then
MsgBox "单据明细保存失败" + Err.Description
cn2.RollbackTrans
saveinfo.Caption = "请重新输入单据明细"
Else
cn2.CommitTrans
MsgBox "单据明细保存成功"
saveinfo.Caption = ""
rs1.Open "select * from ck_prod_his where oddno='" & Trim(Text4.Text) & "' ", cn2, adOpenStatic
Set DataGrid1.DataSource = rs1
End If
cn2.Close
Set cn2 = Nothing
End Sub
cn2.Open "dsn=xx;uid=user;pwd=123"
cn2.CursorLocation = adUseClient
cn2.BeginTrans
cn2.Execute (str2)
If Err Then
MsgBox "单据明细保存失败" + Err.Description
cn2.RollbackTrans
saveinfo.Caption = "请重新输入单据明细"
Else
cn2.CommitTrans
MsgBox "单据明细保存成功"
saveinfo.Caption = ""
rs1.Open "select * from ck_prod_his where oddno='" & Trim(Text4.Text) & "' ", cn2, adOpenStatic
Set DataGrid1.DataSource = rs1
End If
cn2.Close
Set cn2 = Nothing
End Sub
还是不显示,datagrid能看出来闪动,可没有任何数据,把显示的代码单独放到一个按钮里datagrid就显示,为什么啊?
cn2.Open "dsn=xx;uid=user;pwd=123"
cn2.CursorLocation = adUseClient
cn2.BeginTrans
cn2.Execute (str2)
If Err Then
MsgBox "单据明细保存失败" + Err.Description
cn2.RollbackTrans
saveinfo.Caption = "请重新输入单据明细"
Else
cn2.CommitTrans
MsgBox "单据明细保存成功"
saveinfo.Caption = ""
rs1.Open "select * from ck_prod_his where oddno='" & Trim(Text4.Text) & "' ", cn2, adOpenStatic
Set DataGrid1.DataSource = rs1
datagrid1.refresh'刷新一下
End If
cn2.Close
Set cn2 = Nothing
End Sub