驾照理论考试速成软件 MFC源代码下载
驾照理论考试速成,模访一个软件做成的
数据库是mssql2005,在JzData.rar文件中,附加即可;
如果你使用的是sql 2000的数据库,请将debug目录下的access数据库jzdata.mdb转换成sql server数据库,在查询分析器里执行:
代码
exec sp_configure 'show advanced options',1 reconfigure
exec sp_configure 'Ad Hoc Distributed Queries',1 reconfigure
create database jz
go
use jz
SELECT *
INTO car
FROM OPENDATASOURCE ('Microsoft.Jet.OLEDB.4.0',
'Data Source="D:\GCLsoft\jz\Debug\jzdata.mdb";User ID=Admin;Password=' )...car
SELECT *
INTO moto
FROM OPENDATASOURCE ('Microsoft.Jet.OLEDB.4.0',
'Data Source="D:\GCLsoft\jz\Debug\jzdata.mdb";User ID=Admin;Password=' )...moto
use jz
alter table car alter column id int not null
go
alter table car add constraint pkKey1 primary key (id)
alter table moto alter column id int not null
go
alter table moto add constraint pkKey2 primary key (id) --设置主键
exec sp_configure 'Ad Hoc Distributed Queries',1 reconfigure
create database jz
go
use jz
SELECT *
INTO car
FROM OPENDATASOURCE ('Microsoft.Jet.OLEDB.4.0',
'Data Source="D:\GCLsoft\jz\Debug\jzdata.mdb";User ID=Admin;Password=' )...car
SELECT *
INTO moto
FROM OPENDATASOURCE ('Microsoft.Jet.OLEDB.4.0',
'Data Source="D:\GCLsoft\jz\Debug\jzdata.mdb";User ID=Admin;Password=' )...moto
use jz
alter table car alter column id int not null
go
alter table car add constraint pkKey1 primary key (id)
alter table moto alter column id int not null
go
alter table moto add constraint pkKey2 primary key (id) --设置主键
数据库名字:jz
代码是C++写的,用vc6打开
代码写的不好,如果你有什么好的建议,欢迎与我联系
源代码下载地址
在sql2000下,点考试会出现错误:如果语句中包含 UNION 运算符,那么 ORDER BY 子句中的项就必须出现在选择列表中。解决方法,改用视图,在代码里要修改一下:
代码
if exists
(select * from dbo.sysobjects where id = object_id(N'[dbo].[v1]') and OBJECTPROPERTY(id, N'IsView') = 1)
drop view v1
go
create view v1 as
select top 30 * from car where zhanjie=1 ORDER BY NEWID()
go
if exists
(select * from dbo.sysobjects where id = object_id(N'[dbo].[v2]') and OBJECTPROPERTY(id, N'IsView') = 1)
drop view v2
go
create view v2 as
select top 20 * from car where zhanjie=2 ORDER BY NEWID()
go
select * from v1
union all
select * from v2
(select * from dbo.sysobjects where id = object_id(N'[dbo].[v1]') and OBJECTPROPERTY(id, N'IsView') = 1)
drop view v1
go
create view v1 as
select top 30 * from car where zhanjie=1 ORDER BY NEWID()
go
if exists
(select * from dbo.sysobjects where id = object_id(N'[dbo].[v2]') and OBJECTPROPERTY(id, N'IsView') = 1)
drop view v2
go
create view v2 as
select top 20 * from car where zhanjie=2 ORDER BY NEWID()
go
select * from v1
union all
select * from v2
如果不想使用视图,sql语句这样写,也可以解决问题:
代码
select * from
(
select * from
(
select top 30 * from car where zhanjie=1 ORDER BY NEWID()
) as a1
union all
select * from
(
select top 20 * from car where zhanjie=2 ORDER BY NEWID()
) as a2
) as a3
(
select * from
(
select top 30 * from car where zhanjie=1 ORDER BY NEWID()
) as a1
union all
select * from
(
select top 20 * from car where zhanjie=2 ORDER BY NEWID()
) as a2
) as a3