口白:
流動的水沒有形狀,漂流的風找不到蹤跡,任何案件的 Coding 都取決於心
唯一看透真相的是,外表看似卜朧共,智慧卻低於常人的 名卜朧共 刻爛
(謎之音:把 Code 刻到爛簡稱刻爛.爛..爛...)
Music:
#表升半音 []表高八度
4 3 2 6 4 2 3 #6 6 5 4 5 4 5 6 4 3 2 5 4 3 4 2 6 4 5 [2] [1] #6 6 5 6
4 3 2 6 4 2 3 #6 6 5 4 5 4 5 6 4 3 2 4 3 2 4 2 6 4 5 [2] #6 6 5 6
口白:
刻爛:真実はいつも一つ!
1. 打開 edmx (用 ADO.NET 實體資料模型設計工具打開)
2. 選擇你的 DateTime 欄位
3. 到屬性視窗,並改變 StoreGeneratedPattern 屬性值,從 None 改成 Computed
記得要把資料庫中的欄位定義預設值喔!
參考文獻:stackoverflow blog(code-first)
財富、名聲、勢力-沒有全世界財富的Panda‧D‧卜朧共,他在臨行前的一句話,讓人們趨之若鶩、逃離大海!
「想要我的財寶嗎?想要的話可以全部給你,去找吧!我把所有的一切都放在那裡!」
我要成為海怪王
頑皮's
google-code-prettify
星期一, 3月 30, 2015
星期五, 1月 16, 2015
[DotNet] Convert between SqlGeometry and DbGeometry
要怎麼轉呢?跟神魔一樣有自動轉珠讓他自己轉轉轉就太好了...(期待)
SqlGeometry 、DbGeometry 兩者的差異在哪裡?
命名空間: Microsoft.SqlServer.Types 之下的類別 SqlGeometry
而 DbGeometry 則有兩個命名空間
命名空間1:System.Data.Spatial 之下的類別 DbGeometry
命名空間2:System.Data.Entity.Spatial 之下的類別 DbGeometry
不管事哪個命名空間 都有要用的 FromBinary(Byte[]) 、AsBinary 方法!
(擇一使用,看哪個比較適合)
//Convert from SqlGeometry to DbGeometry
SqlGeometry sqlGeo = ...
上面的作法是把 SqlGeometry 用 STAsBinary() 方法,轉成開放式地理空間協會 (Open Geospatial Consortium,OGC) 已知的二進位 (well-known binary,WKB) 結果。
再利用 命名空間: System 之下的類別 Buffer 轉成陣列(是這樣說嗎?)
透過 DbGeometry 類別 FromBinary 方法再把它轉成 DbGeometry 物件
上面的作法是把 DbGeometry 用 AsBinary 方法,轉成 Binary 結果。
再利用 命名空間: System.Data.SqlTypes 之下的類別 SqlBytes 轉成 WKB
透過 SqlGeometry 類別 STGeomFromWKB 方法再把它轉成 SqlGeometry 物件
SqlGeometry 、DbGeometry 兩者的差異在哪裡?
命名空間: Microsoft.SqlServer.Types 之下的類別 SqlGeometry
而 DbGeometry 則有兩個命名空間
命名空間1:System.Data.Spatial 之下的類別 DbGeometry
命名空間2:System.Data.Entity.Spatial 之下的類別 DbGeometry
不管事哪個命名空間 都有要用的 FromBinary(Byte[]) 、AsBinary 方法!
(擇一使用,看哪個比較適合)
//Convert from SqlGeometry to DbGeometry
SqlGeometry sqlGeo = ...
DbGeometry dbGeo = DbGeometry.FromBinary(sqlGeo.STAsBinary().Buffer);
上面的作法是把 SqlGeometry 用 STAsBinary() 方法,轉成開放式地理空間協會 (Open Geospatial Consortium,OGC) 已知的二進位 (well-known binary,WKB) 結果。
再利用 命名空間: System 之下的類別 Buffer 轉成陣列(是這樣說嗎?)
透過 DbGeometry 類別 FromBinary 方法再把它轉成 DbGeometry 物件
//Convert from DBGeometry to SqlGeometry
SqlGeometry sqlGeo2 = SqlGeometry.STGeomFromWKB(new SqlBytes(dbGeo.AsBinary()), 0);上面的作法是把 DbGeometry 用 AsBinary 方法,轉成 Binary 結果。
再利用 命名空間: System.Data.SqlTypes 之下的類別 SqlBytes 轉成 WKB
透過 SqlGeometry 類別 STGeomFromWKB 方法再把它轉成 SqlGeometry 物件
Labels:
VB.Net 程式開發
星期四, 10月 27, 2011
VB.NET App.Config 使用
app.config 設定如下
VB.NET 程式碼
Imports System.Configuration
Dim CNN as String = ConfigurationManager.ConnectionStrings("CNN").ConnectionString)
Dim ROOT As String = ConfigurationManager.AppSettings("ROOT_PATH").ToString
VB.NET 程式碼
Imports System.Configuration
Dim CNN as String = ConfigurationManager.ConnectionStrings("CNN").ConnectionString)
Dim ROOT As String = ConfigurationManager.AppSettings("ROOT_PATH").ToString
Labels:
VB.Net 程式開發
星期一, 9月 05, 2011
【VB】利用 Array.Indexof() 於陣列的字串變數中 的搜尋 對應字串於陣列中的 Index 位置
當 定義一組 矩陣變數 為字串 時,
如何於字串變數中,找到對應的字串位於 矩陣變數中的 Index 值?
可以利用 Array.Indexof() 來搜尋
Array.IndexOf 方法 (Array, Object, Int32)
範例如下:
Dim AttStr() As String = { "aaa", "bbb", "ccc", "abc" }
Dim FindStr As String = ""
Dim FindIndex As Integer
FindStr = "aaa"
FindIndex = Array.IndexOf(FindStr, Str2)
FindIndex = Array.IndexOf(AttStr,FindStr)
' Console.WriteLine(FindIndex) 'Print Output: 0
FindStr = "a"
FindIndex = Array.IndexOf(FindStr, Str2)
FindIndex = Array.IndexOf(AttStr,FindStr)
' Console.WriteLine(FindIndex) 'Print Output: -1
FindStr = "ccc"
FindIndex = Array.IndexOf(FindStr, Str2)
FindIndex = Array.IndexOf(AttStr,FindStr)
' Console.WriteLine(FindIndex) 'Print Output: 2
參考:
MSDN
[入門文章] .NET 陣列詳論
如何於字串變數中,找到對應的字串位於 矩陣變數中的 Index 值?
可以利用 Array.Indexof() 來搜尋
Array.IndexOf 方法 (Array, Object, Int32)
範例如下:
Dim AttStr() As String = { "aaa", "bbb", "ccc", "abc" }
Dim FindStr As String = ""
Dim FindIndex As Integer
FindStr = "aaa"
FindIndex = Array.IndexOf(AttStr,FindStr)
' Console.WriteLine(FindIndex) 'Print Output: 0
FindStr = "a"
FindIndex = Array.IndexOf(AttStr,FindStr)
' Console.WriteLine(FindIndex) 'Print Output: -1
FindStr = "ccc"
FindIndex = Array.IndexOf(AttStr,FindStr)
' Console.WriteLine(FindIndex) 'Print Output: 2
參考:
MSDN
[入門文章] .NET 陣列詳論
Labels:
程式開發
,
Asp.Net 程式開發
,
VB.Net 程式開發
訂閱:
文章
(
Atom
)