數(shù)據(jù)庫詳細(xì)設(shè)計(jì)程序詳細(xì)功能即實(shí)現(xiàn)2.后臺(tái)數(shù)據(jù)庫使用SQL SERVER 實(shí)現(xiàn)。 3.數(shù)據(jù)表要求三個(gè)以上并且之間有外鍵這么完整的東西,沒RMB誰理 ..
創(chuàng)新互聯(lián)主要從事做網(wǎng)站、網(wǎng)站建設(shè)、網(wǎng)頁設(shè)計(jì)、企業(yè)做網(wǎng)站、公司建網(wǎng)站等業(yè)務(wù)。立足成都服務(wù)泗縣,十載網(wǎng)站建設(shè)經(jīng)驗(yàn),價(jià)格優(yōu)惠、服務(wù)專業(yè),歡迎來電咨詢建站服務(wù):18980820575
分類: 電腦/網(wǎng)絡(luò) 程序設(shè)計(jì) 其他編程語言
問題描述:
在SQL數(shù)據(jù)庫里已有一個(gè)現(xiàn)成的空數(shù)據(jù)表(只有字段、沒有數(shù)據(jù)),請問高手,怎樣在VB.NET中用SQL語句把該數(shù)據(jù)庫中的那個(gè)表復(fù)制一個(gè)到該數(shù)據(jù)庫(字段不變、數(shù)據(jù)為空)只是把數(shù)據(jù)表的名改了?
謝謝!謝謝!
解析:
select * into 新表 from 舊表
使用 SELECT INTO 插入行
SELECT INTO 語句創(chuàng)建一個(gè)新表,并用 SELECT 的結(jié)果集填充該表。新表的結(jié)構(gòu)由選擇列表中表達(dá)式的特性定義,例如:
SELECT Shippers.*, Link.Address, Link.City,
Link.Region, Link.PostalCode
INTO NewShippers
FROM Shippers
JOIN LinkServer.DB.dbo.Shippers AS Link
ON (Shippers.ShipperID = Link.ShipperID)
SELECT INTO 可將幾個(gè)表或視圖中的數(shù)據(jù)組合成一個(gè)表。也可用于創(chuàng)建一個(gè)包含選自鏈接服務(wù)器的數(shù)據(jù)的新表。
Private Sub Button _Click(ByVal sender As System Object ByVal e As System EventArgs) Handles Button Click 備份數(shù)據(jù)庫 BACKUP DATABASE Test TO DISK= C:\Backup WITH Format Dim cn As SqlConnection Dim cm As SqlCommand cn = getDB() cm = New SqlCommand( BACKUP DATABASE JXbase TO DISK= C:\Backup WITH Format cn) cn Open() cm ExecuteNonQuery() MsgBox( 備份成功 ) cn Close()
End Sub
恢復(fù) Private Sub Button _Click(ByVal sender As System Object ByVal e As System EventArgs) Handles Button Click Dim cn As New SqlConnection Dim cn As New SqlConnection Dim mydr As SqlDataReader Dim str As String
Dim tmpConnectionString As String = Data Source=JJK;Initial Catalog=master;Integrated Security=True cn ConnectionString = tmpConnectionString cn ConnectionString = tmpConnectionString cn Open() cn Open() Dim cm As SqlCommand = New SqlCommand( select spid from master sysprocesses where dbid=db_id( JXbase ) cn) mydr = cm ExecuteReader()
Dim cm As SqlCommand = New SqlCommand() cm Connection = cn
While (mydr Read()) 殺死進(jìn)程
str = kill mydr( spid ) ToString() cm CommandText = str cm CommandType = CommandType Text Application DoEvents() cm ExecuteNonQuery() 殺進(jìn)程 End While mydr Close() cm = New SqlCommand( RESTORE DATABASE JXbase FROM DISK= C:\Backup cn) 恢復(fù)備份 cm ExecuteNonQuery() MsgBox( 恢復(fù)成功成功 ) cn Close() cn Close()
lishixinzhi/Article/program/net/201311/12901
這個(gè)要做一個(gè)系統(tǒng)的話會(huì)很龐大,你要先設(shè)置一個(gè)提綱,然后才能在提綱的范圍內(nèi)進(jìn)行編碼。你的飯店概念是酒店還是單單吃飯的地方。酒店的話就涉及到每個(gè)房間是否入住,入住人員的基本資料等等。飯店的話就只要注明吃飯的臺(tái)子是否有人在使用便于安排,金額多少等等。