Protected Sub DataList1_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles DataList1.PreRender
Dim dv As DataView = sds_add.Select(DataSourceSelectArguments.Empty)
'datalist 分頁法
Dim a As New PagedDataSource
a.DataSource = dv
a.AllowPaging = True
a.PageSize = 5
a.CurrentPageIndex = h1.Value
DataList1.DataSource = a
DataList1.DataBind()
'Response.Write(DataList1.Items.Count)
End Sub
5月 27, 2010
DataList 分頁法
5月 17, 2010
捕捉新增事件
Sub EmployeeFormView_ItemInserted(ByVal sender As Object, ByVal e As FormViewInsertedEventArgs)
' Use the Exception property to determine whether an exception
' occurred during the insert operation.
If e.Exception Is Nothing Then
' Use the AffectedRows property to determine whether the
' record was inserted. Sometimes an error might occur that
' does not raise an exception, but prevents the insert
' operation from completing.
If e.AffectedRows = 1 Then
MessageLabel.Text = "Record inserted successfully."
Else
MessageLabel.Text = "An error occurred during the insert operation."
' Use the KeepInInsertMode property to remain in insert mode
' when an error occurs during the insert operation.
e.KeepInInsertMode = True
End If
Else
' Insert the code to handle the exception.
MessageLabel.Text = e.Exception.Message
' Use the ExceptionHandled property to indicate that the
' exception has already been handled.
e.ExceptionHandled = True
e.KeepInInsertMode = True
End If
End Sub
5月 11, 2010
SQL 日期函數
SELECT DATEPART(year, GETDATE()) --抓年
SELECT DATEPART(month, GETDATE()) --抓月
SELECT DATEPART(day, GETDATE()) --抓日
DATEDIFF(Day, GETDATE(), 租期止日) AS 相差天數
CONVERT(varchar(12), getdate(), 111) 轉為 yy/mm/dd
CONVERT(varchar(12), getdate(), 105) 轉為 yy-mm-dd
其他:
select CONVERT(varchar, getdate(), 120 )
2004-09-12 11:06:08
select replace(replace(replace(CONVERT(varchar, getdate(), 120 ),'-',''),' ',''),':','')
20040912110608
select CONVERT(varchar(12) , getdate(), 111 )
2004/09/12
select CONVERT(varchar(12) , getdate(), 112 )
20040912
select CONVERT(varchar(12) , getdate(), 102 )
2004.09.12
select CONVERT(varchar(12) , getdate(), 101 )
09/12/2004
select CONVERT(varchar(12) , getdate(), 103 )
12/09/2004
select CONVERT(varchar(12) , getdate(), 104 )
12.09.2004
select CONVERT(varchar(12) , getdate(), 106 )
12 09 2004
select CONVERT(varchar(12) , getdate(), 107 )
09 12, 2004
select CONVERT(varchar(12) , getdate(), 108 )
11:06:08
select CONVERT(varchar(12) , getdate(), 109 )
09 12 2004 1
select CONVERT(varchar(12) , getdate(), 110 )
09-12-2004
select CONVERT(varchar(12) , getdate(), 113 )
12 09 2004 1
select CONVERT(varchar(12) , getdate(), 114 )
11:06:08.177
訂閱:
文章 (Atom)