SELECT:
select [資料欄位] from [資料表] where PK=@PK order by [欄位] [X](X=asc:遞增 X=desc:遞減)
select DISTINCT [資料欄位] from [資料表] (DISTINCT資料重複只取一筆出來)
select Top 5 [資料欄位] from [資料表] (取前5筆資料)
select * from testDB where PK in (select * from test2DB where PK=@PK) (子搜尋使用方法)
UPDATE:
update [資料表] set [欄位]='值',[欄位]='值' where [條件]
INSERT:
insert into [資料表] ([欄位],[欄位],....) Values([值],[值],....)
DELETE:
delete from [資料表] where PK=@PK
加入資料庫連結方法
Web.config
<add Key="ConnectionString" Value="Data Source=.;Initial Catalog=資料庫;uid=使用者名;pwd=使用者密碼;"/>
全站熱搜