口白:
流動的水沒有形狀,漂流的風找不到蹤跡,任何案件的 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
星期一, 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 程式開發
星期五, 4月 22, 2011
List、Array 轉String
宣告一個 List 變數 ArrList
Dim ArrList As New List(Of String)
用 ArrList.Add() 函數可把資料加入 List 中
ArrList.Add("a")
ArrList.Add("b")
'轉陣列
Dim ArrList As New List(Of String)
用 ArrList.Add() 函數可把資料加入 List 中
ArrList.Add("a")
ArrList.Add("b")
'轉陣列
1. 將 ArrList 轉成 String() 陣列
Dim ArrString As String()
ArrString = ArrList.ToArray
2. 將 ArrList 轉成 String 陣列
Dim ArrString() As String
ArrString = ArrList.ToArray
'將 List 轉成 String 分隔符號用逗點分隔
'String.Join(",", ArrList.ToArray)
轉成 String ,內容為 "a,b"
方法1. 直接將 ArrList 轉成字串
Dim sstr As String = String.Join(",", ArrList.ToArray)
方法2 將 arrstring 陣列轉成字串
Dim sstr As String = String.Join(",", arrstring)使用函數
ToArray()
String.Join()
使用宣告變數
List(of String)
String()
String
Labels:
程式開發
,
Asp.Net 程式開發
星期四, 4月 21, 2011
【ASP.NET】利用 Sqldatasource 抓出 Gridview 的 SelectedDataKey
當 Gridview 設定了多個 DataKey 時
Sqldatasource 要如何取得 Selected DataKeys 中的某一個 DataKey
主要是用 ControlParameter 然後定義 PropertyName 為 SelectedDataKey 加上維度即可做到
<asp:ControlParameter ControlID="GridView1" Name="ServiceID" PropertyName="SelectedDataKey[0]" />
---------------------------------------------------------------------------------------------------------------------------
<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>"
SelectCommand="SELECT A,B,C FROM Table WHERE A = @A And B=@B">
<SelectParameters>
<asp:ControlParameter ControlID="GridView1" Name="A" PropertyName="SelectedDataKey[0]" />
<asp:ControlParameter ControlID="GridView1" Name="B" PropertyName="SelectedDataKey[1]" />
</SelectParameters>
</asp:SqlDataSource>
----------------------------------------------------------------------------------------------------------------------------
Sqldatasource 要如何取得 Selected DataKeys 中的某一個 DataKey
主要是用 ControlParameter 然後定義 PropertyName 為 SelectedDataKey 加上維度即可做到
<asp:ControlParameter ControlID="GridView1" Name="ServiceID" PropertyName="SelectedDataKey[0]" />
---------------------------------------------------------------------------------------------------------------------------
<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>"
SelectCommand="SELECT A,B,C FROM Table WHERE A = @A And B=@B">
<SelectParameters>
<asp:ControlParameter ControlID="GridView1" Name="A" PropertyName="SelectedDataKey[0]" />
<asp:ControlParameter ControlID="GridView1" Name="B" PropertyName="SelectedDataKey[1]" />
</SelectParameters>
</asp:SqlDataSource>
----------------------------------------------------------------------------------------------------------------------------
Labels:
Asp.Net 程式開發
訂閱:
文章
(
Atom
)