2.2卸載
目前創(chuàng)新互聯(lián)已為1000多家的企業(yè)提供了網(wǎng)站建設(shè)、域名、雅安服務(wù)器托管、網(wǎng)站托管運(yùn)營(yíng)、企業(yè)網(wǎng)站設(shè)計(jì)、扎賚諾爾網(wǎng)站維護(hù)等服務(wù),公司將堅(jiān)持客戶導(dǎo)向、應(yīng)用為本的策略,正道將秉承"和諧、參與、激情"的文化,與客戶和合作伙伴齊心協(xié)力一起成長(zhǎng),共同發(fā)展。
1、在控制面板中卸載SQL Server2000
2、運(yùn)行(regedit.exe)在注冊(cè)表編輯器中刪除以下選項(xiàng)
?HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSSQLServer
?HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server
?HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MSSQL Server
?HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SQLSERVERAGENT
?HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MSSQLServerADHeper
3、手工刪除SQL Server2000默認(rèn)的安裝目錄c:\program files\microsoft\sql server
4、重新啟動(dòng)計(jì)算機(jī)。
先要拆卸才可以 你操作前先備份注冊(cè)表 XP只可以安裝個(gè)人版啦 再要裝不上的話偶也不知道了
物車(chē)的邏輯業(yè)務(wù)的實(shí)現(xiàn)(MyCartBO.java),能夠滿足用戶的添加,刪除,修改,清空,查看購(gòu)物車(chē)的信息!
ConnDB.java(這只是一個(gè)得到數(shù)據(jù)庫(kù)連接和類(lèi))
01 //連接數(shù)據(jù)庫(kù)
02 package cn.fqfx.model;
03
04 import java.sql.*;
05
06 public class ConnDB
07 {
08 //定義一個(gè)連接
09 private Connection ct = null;
10
11 //得到連接
12 public Connection getConn()
13 {
14 try {
15 //加載驅(qū)動(dòng)
16 Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
17 //得到連接
18 ct = DriverManager.getConnection
19 ("jdbc:microsoft:sqlserver://localhost:1433;databaseName=whdb2","sa","sa");
20 } catch (Exception e) {
21 e.printStackTrace();
22 // TODO: handle exception
23 }
24 return ct;
25 }
26 }
GoodsBean.java(這個(gè)文件主要用來(lái)保存從數(shù)據(jù)庫(kù)的goods表中取得的信息)
01 //這是一個(gè)與Goods表對(duì)應(yīng)的java bean
02 //表的信息可以保存在這里面
03 package cn.fqfx.model;
04
05 public class GoodsBean
06 {
07 //分別與goods表的各個(gè)字段相對(duì)應(yīng)
08 private int goodsId = 0;
09 private String goodsName = "";
10 private String goodsInfo = "";
11 private String goodsPlace = "";
12
13
14 public int getGoodsId() {
15 return goodsId;
16 }
17 public void setGoodsId(int goodsId) {
18 this.goodsId = goodsId;
19 }
20
21
22 public String getGoodsName() {
23 return goodsName;
24 }
25 public void setGoodsName(String goodsName) {
26 this.goodsName = goodsName;
27 }
28
29
30 public String getGoodsInfo() {
31 return goodsInfo;
32 }
33 public void setGoodsInfo(String goodsInfo) {
34 this.goodsInfo = goodsInfo;
35 }
36
37
38 public String getGoodsPlace() {
39 return goodsPlace;
40 }
41 public void setGoodsPlace(String goodsPlace) {
42 this.goodsPlace = goodsPlace;
43 }
44 }
MyCartBO.java(這個(gè)就是購(gòu)物車(chē),主要以HashMap實(shí)現(xiàn)存放用戶想買(mǎi)的商品id,商品數(shù)量.然后,通過(guò)方法的調(diào)用把購(gòu)物車(chē)中的信息返回到界面讓用戶看)
001 //這是一個(gè)業(yè)務(wù)對(duì)象,相當(dāng)于一個(gè)購(gòu)物車(chē)??!
002 //--使用說(shuō)明:這個(gè)購(gòu)物車(chē)最好是在session中使用,因?yàn)橐粋€(gè)用戶一輛購(gòu)物車(chē),這樣?xùn)|西才不會(huì)一直丟
003 package cn.fqfx.model;
004
005 import java.sql.*;
006 import java.util.*;
007
008 public class MyCartBO
009 {
010 //定義幾個(gè)數(shù)據(jù)庫(kù)的連接
011 private Connection ct = null;
012 private PreparedStatement ps = null;
013 private ResultSet rs = null;
014
015 //定義一個(gè)HashMap充當(dāng)購(gòu)物車(chē),第一個(gè)用來(lái)存放goodsId,值就是goods的數(shù)量
016 HashMapString, String hm = new HashMapString, String();
017
018 //當(dāng)用戶想購(gòu)買(mǎi)的時(shí)候,就加入 購(gòu)物車(chē)?yán)锩?/p>
019 public void addGoods(String goodsId, String goodsNumber)
020 {
021 hm.put(goodsId, goodsNumber);
022 }
023
024 //當(dāng)用戶不想要東西的時(shí)候,就把它刪除
025 public void delGoods(String goodsId)
026 {
027 hm.remove(goodsId);
028 }
029
030 //當(dāng)用戶什么也不想要的時(shí)候,就清空它
031 public void clearGoods()
032 {
033 hm.clear();
034 }
035
036 //當(dāng)用戶想更換物品的數(shù)量的時(shí)候,就更新一下
037 public void upGoods(String goodsId, String newNumber)
038 {
039 //還是用加入物品的方法,因?yàn)闀?huì)自動(dòng)替換掉它,如果貨物名字想換,那說(shuō)明用戶想刪除了
040 hm.put(goodsId, newNumber);
041 }
042
043 //得到單個(gè)物品的數(shù)量,要用的話把它轉(zhuǎn)成int型再使用
044 public String getGoodsNumberByGoodsId(String goodsId)
045 {
046 return hm.get(goodsId);
047 }
048
049 //把購(gòu)物車(chē)的東西全部取出來(lái),放入ArrayList里面
050 public ArrayListGoodsBean getAllGoods()
051 {
052 //要知道這個(gè)ArrayList是用來(lái)放GoodsBean,因?yàn)镚oodsBean與表相對(duì)應(yīng),所以可以保存物品的信息
053 ArrayListGoodsBean al = new ArrayListGoodsBean();
054 try {
055 //得到連接
056 ct = new ConnDB().getConn();
057
058 //想一個(gè)sql語(yǔ)句,主要是取得goodsId,就可以全部取出來(lái)給外面的使用
059 String sql = "select * from goods where goodsId in (";
060 IteratorString it = hm.keySet().iterator();
061 while(it.hasNext())
062 {
063 //把goodsId取出來(lái)
064 String goodsId = it.next();
065 if(it.hasNext()){
066 sql += goodsId+",";
067 }else{
068 sql += goodsId+")";
069 }
070 }
071
072 //創(chuàng)建ps,上面把sql語(yǔ)句組織好
073 ps = ct.prepareStatement(sql);
074
075 //執(zhí)行
076 rs = ps.executeQuery();
077
078 //取出來(lái),放在GoodsBean,再把GoodsBean一個(gè)個(gè)放入ArrayList中,顯示的頁(yè)面就可以調(diào)用了
079 while(rs.next())
080 {
081 GoodsBean gb = new GoodsBean();
082 gb.setGoodsId(rs.getInt(1));
083 gb.setGoodsName(rs.getString(2));
084 gb.setGoodsInfo(rs.getString(3));
085 gb.setGoodsPlace(rs.getString(4));
086
087 //把gb放入al,相當(dāng)于保存了從數(shù)據(jù)庫(kù)中獲得的數(shù)據(jù)
088 al.add(gb);
089 }
090 } catch (Exception e) {
091 e.printStackTrace();
092 // TODO: handle exception
093 }finally{
094 this.closeDBResource();
095 }
096 return al;
097 }
098
099 //關(guān)閉數(shù)據(jù)庫(kù)資源
100 public void closeDBResource()
101 {
102 try {
103 if(rs != null){
104 rs.close();
105 rs = null;
106 }
107 } catch (Exception e2) {
108 e2.printStackTrace();
109 // TODO: handle exception
110 }
111 try {
112 if(ps != null){
113 ps.close();
114 ps = null;
115 }
116 } catch (Exception e2) {
117 e2.printStackTrace();
118 // TODO: handle exception
119 }
120 try {
121 if(ct != null){
122 ct.close();
123 ct= null;
124 }
125 } catch (Exception e2) {
126 e2.printStackTrace();
127 // TODO: handle exception
128 }
129 }
130 }
1.把計(jì)算機(jī)名改成大寫(xiě)。(建議這樣做,百益無(wú)一害)
2.刪除c盤(pán)下面的 C:\Program Files\Microsoft SQL Server 整個(gè)文件夾刪除.
原因:當(dāng) Windows 計(jì)算機(jī)名稱包含大寫(xiě)字母和小寫(xiě)字母或者都是小寫(xiě)字母時(shí)安裝會(huì)失敗,提示一般性網(wǎng)絡(luò)錯(cuò)誤!
3.刪除在current_user和local_machine\software\microsoft\ 下有關(guān) Microsoft sql server 全部信息,
如:
HKEY_CURRENT_USER\Software\Microsoft\Microsoft SQL Server
HKEY_CURRENT_USER\SOFTWARE\Microsoft\MSSQLServer
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSSQLServer
4.打開(kāi)注冊(cè)表
在"開(kāi)始"--"運(yùn)行"鍵入 "regedit"
按下列順序點(diǎn)擊打開(kāi)
+ HKEY_LOCAL_MACHINE
+ SOFTWART
+ Microsoft
+ Windows
+ CurrentVersion
+ Setup
+ ExceptionComponents
將 ExceptionComponents 下面的文件夾全部刪除!
如: {60BFF50D-FB2C-4498-A577-C9548C390BB9}
{60BFF50D-FB2C-4498-A577-C9548C390BB9}
{60BFF50D-FB2C-4498-A577-C9548C390BB9}
{60BFF50D-FB2C-4498-A577-C9548C390BB9}
.......
5.如果是從硬盤(pán)安裝,那么sql server 2000的安裝文件不能在中文的目錄下。比如:
d:\使用工具\(yùn)sql server 2000\下這樣的路徑中,不需是英文的路徑中:d:\tools\sql server 2000
下,在中的目錄下,就會(huì)出這個(gè)錯(cuò)誤!
如果是從硬盤(pán)安裝,那么sql server 2000的安裝文件不能在中文的目錄下。比如:
d:\使用工具\(yùn)sql server 2000\下這樣的路徑中,不需是英文的路徑中:d:\tools\sql server 2000
下,在中的目錄下,就會(huì)出這個(gè)錯(cuò)誤!
6.刪除注冊(cè)表中的一項(xiàng):
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SessionManager\FileRenameOperations
原因:可以不重新啟動(dòng)重新安裝SQL 2000 SERVER (有服務(wù)掛起不重啟不讓安裝).
with tt(select 語(yǔ)句1 --初始化
union all
select 語(yǔ)句2)
select * from tt
在select 語(yǔ)句2中from的表里關(guān)聯(lián)with后面的表名tt就形成遞推了。
用標(biāo)準(zhǔn)sql的with實(shí)現(xiàn)遞歸查詢(sql2005以上肯定支持,sql2000不清楚是否支持):
with subqry(id,name,pid) as (
select id,name,pid from test1 where id = 5
union all
select test1.id,test1.name,test1.pid from test1,subqry
where test1.pid = subqry.id
)
select * from subqry;
---算法:記錄個(gè)位數(shù)2的數(shù)據(jù)之間的間距?create?by?youhaoxinqin?2014-7-8?10:50???update?by?youhaoxinqin?2014-7-8?13:44??
create?table?demo(
SSCID?int?identity(1,1),
SSCISSUE?nvarchar(200),
SSCNO?int
)
--初始數(shù)據(jù)
insert?into?demo(SSCISSUE,SSCNO)?values('270070401-001',36642)
insert?into?demo(SSCISSUE,SSCNO)?values('270070401-002',12738)
insert?into?demo(SSCISSUE,SSCNO)?values('270070401-003',93873)
insert?into?demo(SSCISSUE,SSCNO)?values('270070401-004',32579)
insert?into?demo(SSCISSUE,SSCNO)?values('270070401-005',93914)
insert?into?demo(SSCISSUE,SSCNO)?values('270070401-006',82309)
insert?into?demo(SSCISSUE,SSCNO)?values('270070401-007',58517)
insert?into?demo(SSCISSUE,SSCNO)?values('270070401-008',98172)
insert?into?demo(SSCISSUE,SSCNO)?values('270070401-009',90320)
insert?into?demo(SSCISSUE,SSCNO)?values('270070401-010',35304)
insert?into?demo(SSCISSUE,SSCNO)?values('270070401-011',96748)
insert?into?demo(SSCISSUE,SSCNO)?values('270070401-012',30941)
insert?into?demo(SSCISSUE,SSCNO)?values('270070401-013',36642)
insert?into?demo(SSCISSUE,SSCNO)?values('270070401-014',12738)
insert?into?demo(SSCISSUE,SSCNO)?values('270070401-015',93872)
insert?into?demo(SSCISSUE,SSCNO)?values('270070401-017',32579)
insert?into?demo(SSCISSUE,SSCNO)?values('270070401-018',93912)
insert?into?demo(SSCISSUE,SSCNO)?values('270070401-019',82302)
insert?into?demo(SSCISSUE,SSCNO)?values('270070401-020',58522)
insert?into?demo(SSCISSUE,SSCNO)?values('270070401-021',98172)
insert?into?demo(SSCISSUE,SSCNO)?values('270070401-022',90320)
insert?into?demo(SSCISSUE,SSCNO)?values('270070401-023',35304)
insert?into?demo(SSCISSUE,SSCNO)?values('270070401-024',96748)
insert?into?demo(SSCISSUE,SSCNO)?values('270070401-025',30922)
--檢索數(shù)據(jù)
select?*?from?demo?where?SSCNO?like'%2'
--創(chuàng)建全局臨時(shí)表
create?table?##remmber_id_no(
remmberkey?int?identity(1,1),
id?int?,
no?int
)
--創(chuàng)建全局臨時(shí)表
create?table?##remmber_id_no2(
remmberkey?int?identity(1,1),
id?int?,
no?int
)
--創(chuàng)建偏移數(shù)據(jù)
insert?into?##remmber_id_no2(id,no)?values(0,0)
--將算法數(shù)據(jù)存入兩個(gè)全局臨時(shí)表
declare??demo_cursor?cursor?for??select?sscid,sscno?from?demo
go?
open?demo_cursor
declare?@id?int?
declare?@no?int
declare?@count?int
set?@count=0
fetch?next?from??demo_cursor?into?@id,@no
while?@@FETCH_STATUS=0
begin?
select?@count=COUNT(*)?from?demo?where?SSCID=@id?and?SSCNO?like'%2'
if(@count0)
begin?
insert?into?##remmber_id_no(id,no)?values(@id,@no)
insert?into?##remmber_id_no2(id,no)?values(@id,@no)
end
fetch?next?from??demo_cursor?into?@id,@no
end?
close?demo_cursor
deallocate??demo_cursor
--得出id距離
select?(t.id-t2.id)?as?ID距離?from?
(select?*?from?##remmber_id_no??where?remmberkey?not?in(select?top?1?remmberkey?from?##remmber_id_no??))?as?t,
(select?*?from?##remmber_id_no2?where?remmberkey?not?in(select?top?1?remmberkey?from?##remmber_id_no2??))?as?t2
where?t.remmberkey=t2.remmberkey
drop?table?##remmber_id_no
drop?table?##remmber_id_no2