SQL Server 增刪改查的實踐

2021-08-15 08:05:05 字數 988 閱讀 4380

插入單行

insert [into] 《表名》 (列名) values (列值)

delete from 《表名》 [where 《刪除條件》]

例如:在機房中下機時刪除online_info表

txtsql = "delete from online_info where cardno= '" & txtcardno.text & "'"

set mrcon = executesql(txtsql, msgtext)

update 《表名》 set 《列名=更新值》 [where 《更新條件》]

例如:在機房中下機時更新line_info表

txtsql = "update line_info set offdate=trim(txtoffdate.text) ,offtime=trim(txtofftime.text),consumtime= trim(txtctime.text) where ondate='" & trim(txtondate.text) & "' and ontime='" & trim(txtontime.text) & "'"

set mrcline = executesql(txtsql, msgtext)

select 《列名》 from 《表名》 [where 《查詢條件表達試》] [order by 《排序的列名》[asc或desc]]

例如:在機房中下機時查詢online_info表

txtsql = "select * from online_info where cardno='" & txtcardno.text & "'"

set mrcon = executesql(txtsql, msgtext)

在資料庫的學習中,sql語言占有重要的地位,不僅如此,在之後的學生系統中,和機房收費系統中,sql語句都占有很重要的地位。不僅如此sql語句在一定的程度上也簡化了**,因此要好好重視sql語句喲。

SQL Server 增刪改查基礎

主鍵為自增時可不填寫 插入單條資料 insert into product values 008 原子筆 辦公用品 100,null,2019 11 11 insert into product select 008 原子筆 辦公用品 100,null,2019 11 11 插入多條資料 inser...

Sql server 實現增刪改查

vs2008 c sql server csharp view plain copy using system.data.sqlclient csharp view plain copy sqlconnection conn csharp view plain copy 連線資料庫 private ...

Sqlserver 增刪改查 改

我們就以院系,班級,學生來舉例。create table dbo yuanxi id int identity 1,1 not null,學校id 自增量 yuanxiname varchar 50 null,院系名字 create table dbo class id int identity 1...