我晕,学校做过一个系统,但是现在忘了怎么弄。我现在想做个报价表,能通过产品名称查询产品信息及价格。可以修改、添加、删除、保存产品信息。谁能有个添加、删除等功能的实例啊,不一定要一样,像学校里做的学生表查询差不多实例给我就行,我主要是有些语句忘了。
解决方案 »
- VB怎么向指定的一个窗口内发送键盘指令
- 如何利用inputbox來合並多個工作表的內容?
- 什么算法可以实现动态编号?
- VB窗体显示问题
- 怎样使ActiveX Dll 中包含的窗体以无模式窗体显示?
- 兄弟要做毕业设计,不知VB合适还是VF
- 请教怎样才能改变图标!
- 在VB中怎样删除一个文件!
- 怎样恢复用chkdsk g:/f命令修复过的磁盘下的文件?
- 请问:使用MSFlexGrid的ADDITEM加入内容,怎样使新增的内容始终被显示出来,即滚动条始终停在最下方?
- VB如何判断一个GIF图片是否动态的GIF,并获得动态GIF有几副图片
- VB如何取得SQLServer数据表中的列名及属性,并在本地Access中创建数据库表
On Error GoTo GetERR
Dim sData(4), s, sCmd As String Set EF = New ADODB.Recordset
Set EF = oCmn.ExecRS(sTm, DCN)
If Not (EF.EOF And EF.BOF) Then
AddSiteType = False
MsgBox "Sorry,¡¾" & sName & "¡¿already exist,input another name£¿ ", vbExclamation
Else
sData(0) = GetTableID("tables")
sData(1) = sName
sData(2) = x
sData(3) = y
sData(4) = sGroup
s = Join(sData, "','")
sCmd = "insert into tables (TableID,TableName,x,y,TableGroupID) " & "VALUES ('" & s & "')"
oCmn.ExecSql sCmd, DCN
AddSiteType = True
End If
Exit Function
GetERR:
MsgBox "add site error:" & Err.Description, vbCritical
End Function
Private Function EditSiteType(sName As String, sOldName As String, sSql As String, x As String, y As String, sGroup As String) As Boolean
On Error GoTo GetERR Set EF = New ADODB.Recordset
If UCase(sName) <> UCase(sOldName) Then
Set EF = New ADODB.Recordset
EF.Open "Select * from Tables Where TableName='" & sName & "'", DCN, adOpenStatic, adLockReadOnly, adCmdText
If Not (EF.EOF And EF.BOF) Then
EF.close
Set EF = Nothing
EditSiteType = False
MsgBox "Sorry,¡¾" & sName & "¡¿exist!", vbExclamation
Exit Function
End If
EF.close
Set EF = Nothing
End If
EF.Open sSql, DCN, adOpenStatic, adLockOptimistic, adCmdText
If EF.EOF And EF.BOF Then
EditSiteType = False
MsgBox "Sorry,¡¾" & sOldName & "¡¿not exist,Edit Error£¿ ", vbExclamation
Else
If EF("SiteStatus") = 2 Then
EF.close
Set EF = Nothing
EditSiteType = False
MsgBox "¡¾" & sName & "¡¿is using,can't edit¡£Please edited after checkout.", vbExclamation
Exit Function
End If
EF("TableName") = sName
EF("X") = x
EF("Y") = y
EF("TableGroupID") = sGroup
EF.Update
EditSiteType = True
End If
EF.close
Set EF = Nothing
Exit Function
GetERR:
EditSiteType = False
MsgBox "Save Error:" & Err.Description, vbCritical
End Function
Public Function DeleteSiteType(sName As String, sTable As String) As Boolean
On Error GoTo GetERR
Dim oRs As New ADODB.Recordset
Dim nNo, sCmd As String Set EF = New ADODB.Recordset EF.Open "Select * from Tables Where TableName='" & sName & "'", DCN, adOpenStatic, adLockReadOnly, adCmdText
If EF.EOF And EF.BOF Then
EF.close
Set EF = Nothing
DeleteSiteType = True
Exit Function
Else
If EF("SiteStatus") > 0 Then
EF.close
Set EF = Nothing
DeleteSiteType = False
MsgBox "Sorry,Table has been available or Reserved,can't deleted£¿ ", vbInformation
Exit Function
End If
End If
DCN.Execute "Delete From " & sTable & " Where TableName='" & sName & "'"
'update TableRunningNO
Set oRs = New ADODB.Recordset
sCmd = "select * from tables order by tableID desc limit 1"
oRs.Open sCmd, DCN, adOpenStatic, adLockOptimistic, adCmdText
nNo = oRs.Fields("tableID")
oRs.close
Set oRs = Nothing
sCmd = "Update RunningNumber set "
sCmd = sCmd & "RunningNo=" & nNo
sCmd = sCmd & " Where "
sCmd = sCmd & " ModuleName='" & sTable & "'"
oCmn.ExecSql sCmd, DCN
EF.close
Set EF = Nothing
DeleteSiteType = True
Exit Function
GetERR:
DeleteSiteType = False
MsgBox "Del Error:" & Err.Description, vbCritical
End Function
http://xueban69.download.csdn.net/
http://download.csdn.net/source/1887292