為了減少大檔案在資料庫的儲存對資料庫的讀寫效率造成的壓力,多了filestream這乙個功能,下面介紹一下如何快速使用filestream。
1、開啟sqlserver例項對filestream 的開關,具體開關在 sql server配置管理器裡面,都開啟。
2、開啟ssms 在例項配置 ,這樣就開啟了filestream的選項
3、新增支援filestream 的檔案組
alter4、現在就可以建立關於filestream的表了database
testdb
addfilegroup filestreamfilegroup contain filestream
然後往檔案組新增檔案
alter
database testdb add
file (name=file2,filename=
'path
') to filegroup filestreamfg
createtable
testtb
( id
uniqueidentifier rowguid primary
key,
filedata
varbinary(max
) filestream)--
好的喲~這樣就建立了一張能使用的filestream表了
insert
into
testtb
(id,filedate)
values(newid(),cast('
12345jonanofe'as
varbinary(max)))
使用FileStream讀寫資料
這節講一下使用filestream讀寫資料,這是乙個比較基礎的流。filestream類只能處理原始位元組,所以它可以處理任何型別的檔案。先看一下它的構造方法 filestream fs new filestream demo.txt filemode.open,fileaccess.read 這個...
WCF簡單步驟
記錄乙個 內容對我有點深,以後可能有用。一 vs2008解決方案下新增 新建專案 wcf wcf服務庫 一般在這裡定義服務契約 資料契約,並實現。二 發布到iis上 vs2008解決方案下新增 新建 wcf服務 會有svc檔案和web.config檔案,要進行修改 然後 發布 記得在iis要讓其支援...
使用FileStream物件讀寫檔案
在專案開發中經常會涉及到對檔案的讀寫,c 提供了很多種方式來對檔案進行讀寫操作,今天來說說filestream 物件。filestream表示在磁碟或網路路徑上指向檔案的流。一般操作檔案都習慣使用streamreader 和 streamwriter,因為它們操作的是字元資料 而filestream...