CSDN论坛 > VB > VB基础类

regjts.Open "select * from bbbb", cnn, adOpenKeyset, adLockOptimistic, adCmdText [问题点数:0分]

Bbs2
本版专家分:385
结帖率 100%
CSDN今日推荐
匿名用户不能发表回复!
其他相关推荐
手机管理系统
操作简单,适合小型手机店铺。Dim rs1 As New ADODB.Recordset Private Sub cmdexit_Click() frmmain.Visible = True Unload Me End Sub Private Sub cmdOK_Click() If txtuserid.Text = "" Then MsgBox "请输入操作员编号!", vbOKOnly + vbInformation, "修改密码" txtuserid.Text = "" txtuserid.SetFocus Exit Sub Else rs1.Open "select * from 密码 where 操作员编号= '" & Trim(txtuserid.Text) & "'", cnn, adOpenKeyset, adLockOptimistic If rs1.RecordCount > 0 Then txtusername.Text = Trim(rs1.Fields("操作员名称")) End If rs1.Close End If If txtusername.Text = "" Then MsgBox "操作员编号不存在!", vbOKOnly + vbInformation, "修改密码" txtuserid.Text = "" txtuserid.SetFocus Exit Sub End If If txtoldpass.Text = "" Then MsgBox "请输入旧密码!", vbOKOnly + vbInformation, "修改密码" txtoldpass.SetFocus Exit Sub End If If txtnewpass.Text = "" Then MsgBox "请输入新密码!", vbOKOnly + vbInformation, "修改密码" txtnewpass.SetFocus Exit Sub End If If txtnewpass1.Text = "" Then MsgBox "请再次输入新密码!", vbOKOnly + vbInformation, "修改密码" txtnewpass1.SetFocus Exit Sub End If rs1.Open "select * from 密码 where 操作员编号= '" & Trim(txtuserid.Text) & "'", cnn, adOpenKeyset, adLockOptimistic If rs1.RecordCount > 0 Then If txtoldpass.Text <> Trim(rs1.Fields("密码")) Then MsgBox "旧密码不正确!", vbOKOnly + vbInformation, "修改密码" txtoldpass.Text = "" txtoldpass.SetFocus Else If txtnewpass.Text = txtnewpass1.Text Then rs1.Fields("密码") = txtnewpass.Text rs1.Update MsgBox "密码修改成功!", vbOKOnly + vbInformation, "修改密码" rs1.Update txtuserid.SetFocus Else MsgBox "两次输入的密码不一致,请重新输入!", vbOKOnly + vbInformation, "修改密码" txtnewpass.Text = "" txtnewpass1.Text = "" txtnewpass.SetFocus End If End If End If rs1.Close End Sub Private Sub Form_Activate() txtuserid.SetFocus End Sub Private Sub txtNewPass_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then txtnewpass1.SetFocus End If End Sub Private Sub txtNewPass1_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then cmdok.SetFocus End If End Sub Private Sub txtOldPass_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then txtnewpass.SetFocus End If End Sub Private Sub txtUserId_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then txtoldpass.SetFocus End If End Sub Private Sub txtUserId_Change() txtusername.Text = "" txtoldpass.Text = "" txtnewpass.Text = "" txtnewpass1.Text = "" End Sub Private Sub txtuserid_LostFocus() rs1.Open "select * from 密码 where 操作员编号= '" & Trim(txtuserid.Text) & "'", cnn, adOpenKeyset, adLockOptimistic If rs1.RecordCount > 0 Then If rs1.RecordCount > 0 Then txtusername.Text = Trim(rs1.Fields("操作员名称")) If txtusername.Text = "" Then MsgBox "操作员编号不存在!", vbOKOnly + vbInformation, "修改密码" txtuserid.Text = "" txtuserid.SetFocus Exit Sub End If End If End If rs1.Close End Sub
VB+Access实例:使用ADO连接Access数据库
VB+Access实例:使用ADO连接Access数据库。Private Sub Form_Load() Dim cn As New ADODB.Connection Dim rs As New ADODB.Recordset cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db_medicine.MDB" rs.Open "tb_kc", cn, adOpenKeyset, adLockOptimistic 'adOpenKeyset打开键集类型游标。adLockOptimistic开放式锁定(逐个) — 提供者使用开放式锁定,只在调用Update 方法时才锁定记录 Set MSHFlexGrid1.DataSource = rs MSHFlexGrid1.ColWidth(0) = 0 '返回或设置指定带区中的列宽 rs.Close cn.Close Set rs = Nothing Set cn = Nothing End Sub
数据库表分区详解
数据库优化的一部分详解 select count(*) from dcsj_time subpartition(dcsj_time_2012_04) select count(*) from dcsj_time partition(dcsj_time_2012) select * from user_tab_partitions select * from user_tab_subpartitions
oracle中将列拼接字段函数
select WMSYS.WM_CONCAT(contractid) from fin_cbs_manager select contractid from fin_cbs_manager
vb小项目(关于学生信息系统)
关于vb项目设计 Private Sub Command1_Click() Dim cnn As New ADODB.Connection Dim strcnn As String Dim rst As New ADODB.Recordset Dim sql As String strcnn = "provider=sqloledb.1;integrated security=sspi;database=students" cnn.Open strcnn sql = "select * from 班级" If xiaoniao = 1 Then Form1.Caption = "class" rst.Open sql, cnn, adOpenStatic, adLockReadOnly Set Me.DataGrid1.DataSource = rst xiaoniao = 0 Else Form1.Caption = "jiangxuejin" sql = "select * from 奖学金" rst.Open sql, cnn, adOpenStatic, adLockReadOnly Set Me.DataGrid1.DataSource = rst xiaoniao = 1 End If 'rst.Close 'cnn.Close End Sub
数据库的操作练习和讲解
萨师煊、王珊老师的 (1) select * from teacher where Sname not like '张%' and Sname not like '王%' (2) select * from teacher where tid not in ( select distinct tid from tb ) 或者 select * from teacher where not exists ( select * from tb where teacher.tid=tb.tid )
oracle 分页语句
select * from (select a.*,rownum rn from (select * from tablename) a where rownum<=10) where rn>2
12_ORCLE数据库管理_示例脚本
--查看数据文件 select * from v$datafile --通过v$log可以查看日志组,v$logfile可以查看具体的成员文件 select * from v$log select * from v$logfile --列出实例中所有控制文件的名字及状态信息 select * from v$controlfile --列出所有参数的位置及状态信息 select * from v$parameter --列出控制文件中记录的部分信息 select * from v$controlfile_record_section --------------------------------------------------- --查询表空间 select * from dba_tablespaces --查询数据文件 select * from dba_data_files --空闲区查询 select * from dba_free_space
SQL语法大全及实例
select的用法 --每个员工的所有信息 select * from emp; --每个人的部门编号,姓名,薪水 select empno, ename, sal from emp; --每个人的年薪 select ename, sal*12 from emp;
sqlserver数据库常用语句基本涵盖日常所需,带中文解释说明
选择:select * from table1 where 范围 插入:insert into table1(field1,field2) values(value1,value2) 删除:delete from table1 where 范围 更新:update table1 set field1=value1 where 范围 查找:select * from table1 where field1 like ’%value1%’ ---like的语法很精妙,查资料! 排序:select * from table1 order by field1,field2 [desc] 总数:select as totalcount from table1 求和:select sum(field1) as sumvalue from table1 平均:select avg(field1) as avgvalue from table1 最大:select max(field1) as maxvalue from table1 最小:select min(field1) as minvalue from table1
关闭
关闭