帮忙设计一个最简单的VB程序(查询当前时间和日期的)要代码

帮忙设计一个最简单的VB程序(查询当前时间和日期的)要代码,第1张

哪有那么麻烦啊?这样就可以了!我先在电脑上运行了的。

两个command,(分别是显示和清除)一个label来显示时间,一个timer

属性设置:

label1清除内容,钟表的interva设为1000,表示1秒,enadled设为false表示为不可用。

Private Sub Command1_Click()

Timer1Enabled = True

Label1Caption = Date + Time

End Sub

Private Sub Command2_Click()

Timer1Enabled = False

Label1Caption = ""

End Sub

Private Sub Timer1_Timer()

Label1Caption = Date + Time

End Sub

共三个命令。

最简单的方式就是:

建立路线表,分类路表,分类路线表,关联路线表。。

每次查询,都读取下当前用户输入的值进行匹配,模糊查询,就可以了。

比如:分类路表:1路,2路,3路,4路。。。。

分类路线表:新街口,中华门,中胜。

关联路线表-1路有新街口,2路有中华门。。。

程序做灵活或者可以就定义死,都可以。。。应该是很简单的。,

回头把邮箱给我。

'首先要在VB中 引用 EXCEL

'在FORM 中 绘制 textbox ×2 commandbutton × 1

'先打开 EXCEL 第一列输入 查询字段 第二列 输入 结果内容

'先点击COMMAND1 连接EXCEL

'在TEXT1中 输入查询字段 点击COMMAND2 TEXT2中显示结果

'在VB6 EXCEL 2003测试通过

'如有疑问 请留言

Option Explicit

Dim I, J, K, L As Long

Dim ROW_COUNT, COL_COUNT As Long

Dim EXCEL_APP As ExcelApplication '声明EXCEL对象

Private Sub Command1_Click()

Set EXCEL_APP = GetObject(, "ExcelApplication") '连接EXCEL

End Sub

Private Sub Command2_Click()

ROW_COUNT = EXCEL_APPActiveSheetUsedRangeRowsCount '查询有多少行数据被使用,以获得最小的查询范围

EXCEL_APPActiveCellOffset(1 - EXCEL_APPActiveCellRow, 1 - EXCEL_APPActiveCellColumn)Select '定位于 左上角

Text2Text = ""

For I = 1 To ROW_COUNT

If EXCEL_APPCells(I, 1)Value = Text1Text Then

Text2Text = EXCEL_APPCells(I, 2)Value

I = 100 + ROW_COUNT

End If

Next I

End Sub

set nocount on

--创建文件夹

exec xp_cmdshell 'md D:\bank',no_output

--建库

use master

if exists(select from sysdatabases where name='bankDB')

drop database bankDB

go

create database bankDB

on

(

name='bankDB',

filename='D:\bank\bankDBmdf'

)

go

use bankDB

go

--建立用户信息表

create table userInfo

(

customerID int identity(1,1),--顾客编号

customerName varchar(10) not null,--开户名

PID char(19) not null,--身份z

telephone char(13) not null,--联系电话

address text --居住地址

)

--用户表约束

alter table userInfo

add constraint PK_customerID primary key(customerID)

,constraint CK_PID check(len(PID)=18 or len(PID)=15)

,constraint UQ_PID unique(PID)

,constraint CK_telephone check(telephone like '____-________' or len(telephone)=11)--建立yhk信息表

create table cardInfo

(

cardID char(19) not null,--卡号

curType char(4) not null,--货币种类

savingType char(10) not null,--存款类型

openDate datetime not null,--开户日期

openMoney money not null,--开户金额

balance money not null,--余额

pass char(6) not null,--密码

IsReportLoss char(2) not null,--是否挂失

customerID int not null --顾客编号

)

--银行表约束

alter table cardInfo

add constraint PK_cardID primary key(cardID)

,constraint CK_cardID check(len(cardID)=19)

,constraint DF_curType default('RMB') for curType

,constraint CK_savingType check(savingType in('活期','定活两便','定期'))

,constraint DF_openDate default(getdate()) for openDate

,constraint CK_openMoney check(openMoney>=1)

,constraint CK_balance check(balance>=1)

,constraint DF_pass default('888888') for pass

,constraint CK_IsReportLoss check(IsReportLoss in ('是','否'))

,constraint DF_IsReportLoss default ('否') for IsReportLoss

,constraint FK_cardInfo_userInfo foreign key(customerID) references userInfo(customerID)--建立交易信息表

create table transInfo

(

transDate datetime not null,--交易时间

cardID char(19) not null,--卡号

transType char(4) not null,--交易类型

transMoney money not null,--交易金额

remark text --备注

)

--交易表约束

alter table transInfo

add constraint DF_transDate default(getdate()) for transDate

,constraint FK_transInfo_cardInfo foreign key(cardID) references cardInfo(cardID)

,constraint CK_transType check(transType in ('存入','取出'))

,constraint CK_transMoney check(transMoney>0)--插入测试数据

--插入测试数据

delete from cardInfodelete from userInfo

declare @customerID int

insert into userInfo values('张三',123456789012345,'0010-67898978','北京海淀')

select @customerID=max(customerID) from userInfo

insert into cardInfo (cardID,savingType,openMoney,balance,customerID)

values('1010 3576 1234 5678','活期',1000,1000,@customerID)insert into userInfo (customerName,PID,telephone)

values('李四',321245678912345678,'0478-44443333')

select @customerID=max(customerID) from userInfo

insert into cardInfo(cardID,savingType,openMoney,balance,customerID)

values('1010 3576 1212 1134','定期',1,1,@customerID)select from userInfo

select from cardInfo--张三取900,李四存5000

insert into transInfo(transType,cardID,transMoney) values('取出','1010 3576 1234 5678',900)

update cardInfo set balance = balance-900 where cardID='1010 3576 1234 5678' insert into transInfo(transType,cardID,transMoney) values('存入','1010 3576 1212 1134',5000)

update cardInfo set balance = balance+5000 where cardID='1010 3576 1212 1134'--7常规业务模拟

--1修改密码

update cardInfo set pass=123456 where cardID='1010 3576 1234 5678'

update cardInfo set pass=123123 where cardID='1010 3576 1212 1134'

--2李四申请挂失

update cardInfo set IsReportLoss='是' where cardID='1010 3576 1212 1134'

select from cardInfo

--3统计银行的资金流通余额和盈利结算

declare @inMoney money,@outMoney money

select @inMoney=sum(transMoney) from transInfo where transType ='存入'

select @outMoney=sum(transMoney) from transInfo where transType='取出'

print '银行流通余额总计为:'+convert(varchar(10),(@inMoney-@outMoney))+'RMB'

print '盈利结算为:'+convert(varchar(10),(@outMoney0008-@inMoney0003))

--4查询本周开户的卡号,显示该卡相关信息。

SELECT FROM cardInfo WHERE (DATEDIFF(Day,getDate(),openDate)<DATEPART(weekday,openDate))

/---------查询本月交易金额最高的卡号----------------------/

SELECT FROM transInfo

SELECT DISTINCT cardID FROM transInfo WHERE transMoney=(SELECT Max(transMoney) FROM transInfo)

/---------查询挂失帐号的客户信息---------------------/

SELECT customerName as 客户姓名,telephone as 联系电话 FROM userInfo

WHERE customerID IN (SELECT customerID FROM cardInfo WHERE IsReportLoss='是')

/------催款提醒:例如某种业务的需要,每个月末,如果发现用户帐上余额少于200元,将致电催款。---/

SELECT customerName as 客户姓名,telephone as 联系电话,balance as 帐上余额

FROM userInfo INNER JOIN cardInfo ON userInfocustomerID=cardInfocustomerID WHERE balance<200

以上就是关于帮忙设计一个最简单的VB程序(查询当前时间和日期的)要代码全部的内容,包括:帮忙设计一个最简单的VB程序(查询当前时间和日期的)要代码、求用C#编写的简单的公交路线查询程序、利用vb6查询Excel表格数据等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/zz/9327012.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-04-27
下一篇2023-04-27

发表评论

登录后才能评论

评论列表(0条)

    保存