请求高手帮我将VB程序段翻译成Delphi语句,谢谢!!
PrivateSubCommand1_Click()DimsqlstrAsStringIfCombo1.Text=""ThenMsgBox"模块名称不能为空"Combo1...
Private Sub Command1_Click()
Dim sqlstr As String
If Combo1.Text = "" Then
MsgBox "模块名称不能为空"
Combo1.SetFocus
Else
ModuleID = Combo1.Text
sqlstr = "select * from tbl_testItem where test_ModuleID=" + " " + "'" + ModuleID + "'"
datacmd.CommandText = sqlstr
datacmd.CommandType = adCmdText
datacmd.ActiveConnection = DataConn
Set DataRec = datacmd.Execute
If newflag = True Then
If Not DataRec.EOF Then
MsgBox "该模块名称已经存在,请输入新的模块名称!"
Combo1.Text = ""
Combo1.SetFocus
Else
Form2.Show
Unload Me
End If
End If
If openflag = True Then
If DataRec.EOF Then
MsgBox "要打开的模块不存在,请选择打开已经建立的模块!"
Combo1.Text = ""
Combo1.SetFocus
Else
Form2.Show
Unload Me
End If
End If
If dltflag = True Then
sqlstr = "delete from tbl_testitem where test_moduleID=" + " " + "'" + ModuleID + "'"
Dim res As String
res = MsgBox("是否确定要删除该模板?", vbOKCancel, "确定删除")
If res = vbOK Then
If DataRec.State = adStateOpen Then
DataRec.Close
End If
DataRec.Open sqlstr, DataConn, adOpenDynamic
MsgBox "模板" + ModuleID + "已经被删除", vbOKOnly, "确定"
Combo1.Text = ""
Combo1.Clear
sqlstr = "select distinct test_ModuleID from Tbl_testitem"
If DataRec.State = adStateOpen Then
DataRec.Close
End If
DataRec.Open sqlstr, DataConn, adOpenStatic
While Not DataRec.EOF
For i = 1 To DataRec.RecordCount
Combo1.AddItem (DataRec.Fields(0))
DataRec.MoveNext
Next i
Wend
End If
If res = vbCancel Then
Combo1.Text = ""
End If
End If
End If
End Sub 展开
Dim sqlstr As String
If Combo1.Text = "" Then
MsgBox "模块名称不能为空"
Combo1.SetFocus
Else
ModuleID = Combo1.Text
sqlstr = "select * from tbl_testItem where test_ModuleID=" + " " + "'" + ModuleID + "'"
datacmd.CommandText = sqlstr
datacmd.CommandType = adCmdText
datacmd.ActiveConnection = DataConn
Set DataRec = datacmd.Execute
If newflag = True Then
If Not DataRec.EOF Then
MsgBox "该模块名称已经存在,请输入新的模块名称!"
Combo1.Text = ""
Combo1.SetFocus
Else
Form2.Show
Unload Me
End If
End If
If openflag = True Then
If DataRec.EOF Then
MsgBox "要打开的模块不存在,请选择打开已经建立的模块!"
Combo1.Text = ""
Combo1.SetFocus
Else
Form2.Show
Unload Me
End If
End If
If dltflag = True Then
sqlstr = "delete from tbl_testitem where test_moduleID=" + " " + "'" + ModuleID + "'"
Dim res As String
res = MsgBox("是否确定要删除该模板?", vbOKCancel, "确定删除")
If res = vbOK Then
If DataRec.State = adStateOpen Then
DataRec.Close
End If
DataRec.Open sqlstr, DataConn, adOpenDynamic
MsgBox "模板" + ModuleID + "已经被删除", vbOKOnly, "确定"
Combo1.Text = ""
Combo1.Clear
sqlstr = "select distinct test_ModuleID from Tbl_testitem"
If DataRec.State = adStateOpen Then
DataRec.Close
End If
DataRec.Open sqlstr, DataConn, adOpenStatic
While Not DataRec.EOF
For i = 1 To DataRec.RecordCount
Combo1.AddItem (DataRec.Fields(0))
DataRec.MoveNext
Next i
Wend
End If
If res = vbCancel Then
Combo1.Text = ""
End If
End If
End If
End Sub 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询