Private Sub myGridView_RowDataBound(sender As Object, e As GridViewRowEventArgs)
'*** hplHyperLink ***'
Dim hplHyperLink As HyperLink = CType(e.Row.FindControl("hplHyperLink"),HyperLink)
IF Not IsNothing(hplHyperLink) Then
hplHyperLink.NavigateUrl = "#"
hplHyperLink.Attributes.Add("Onclick", "javascript::openPopup('item_detail.aspx?id=" & e.Row.DataItem("CustomerID") & "&name=" & e.Row.DataItem("Name") & "');")
End IF
End Sub
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Process.Click
Dim strDate As String = Now.ToString("yyyy-MM-dd", System.Globalization.DateTimeFormatInfo.InvariantInfo)
txt_start.Text = strDate
txt_end.Text = strDate
conn.Open()
Dim sqlOrder As String
sqlOrder = " SELECT ovst.hn,pt.dspname,pt.brthdate ,DtoAge(Pt.BrthDate, trunc(sysdate), 3) As Age,ovst.vstDate FROM pt,ovst "
sqlOrder &= " WHERE pt.hn=ovst.hn "
sqlOrder &= " AND ovst.vstDate >= to_date('" & txt_start.Text = strDate & "','yyyy-MM-dd') )"
sqlOrder &= " AND Ovst.VstDate <= to_date('" & txt_end.Text = strDate & "','yyyy-MM-dd') "
da = New OracleDataAdapter(sqlOrder, conn)
da.Fill(ds, "ovst")
If ds.Tables("ovst").Rows.Count <> 0 Then
GridView1.DataSource = ds.Tables("ovst")
GridView1.DataBind()
End If
End Sub
Dim ci As New System.Globalization.CultureInfo("en-US")
'ถ้า พศ. เปลี่ยนเป็น th-TH
For Each d As DataRow In ds.Tables("ovst").Rows
Dim vstDate As Date = CType(d("vstDate"), Date)
d("vstDate") = vstDate.ToString("yyyy-MM-dd", ci)
Next
GridView1.DataSource = ds.Tables("ovst")
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Process.Click
conn.Open()
Dim ci As New System.Globalization.CultureInfo("en-US")
Dim sqlOrder As String
sqlOrder = " SELECT ovst.hn,pt.dspname,pt.brthdate ,DtoAge(Pt.BrthDate, trunc(sysdate), 3) As Age,ovst.vstDate FROM pt,ovst "
sqlOrder &= " WHERE pt.hn=ovst.hn "
sqlOrder &= " AND ovst.vstDate >= to_date('" & txt_start.Text & "','yyyy-MM-dd') "
sqlOrder &= " AND Ovst.VstDate <= to_date('" & txt_end.Text & "','yyyy-MM-dd') "
da = New OracleDataAdapter(sqlOrder, conn)
da.Fill(ds, "ovst")
For Each d As DataRow In ds.Tables("ovst").Rows
Dim vstDate As Date = CType(d("vstDate"), Date)
d("vstDate") = vstDate.ToString("yyyy-MM-dd", ci)
Next
GridView1.DataSource = ds.Tables("ovst")
GridView1.DataBind()
End Sub
เหมือนเดิมครับ
details.aspx?hn=460006532&start=11/15/2011 12:00:00 AM &end=11/15/2011 12:00:00 AM
Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Me.IsPostBack Then
Exit Sub
End If
Dim ci As New System.Globalization.CultureInfo("en-US")
Dim ds As New Data.DataSet()
Dim dtOvst As Data.DataTable = ds.Tables.Add("ovst")
dtOvst.Columns.Add("hn")
dtOvst.Columns.Add("oldVstDate")
dtOvst.Columns.Add("vstDate")
For i As Integer = 0 To 10
Dim dr As Data.DataRow = dtOvst.NewRow()
dr("hn") = i
dr("oldVstDate") = Now.AddDays(i)
dr("vstDate") = dr("oldVstDate")
dtOvst.Rows.Add(dr)
Next
For Each d As Data.DataRow In ds.Tables("ovst").Rows
Dim vstDate As Date = CType(d("vstDate"), Date)
d("vstDate") = vstDate.ToString("yyyy-MM-dd", ci)
d("hn") = CInt(d("hn")).ToString(Now.ToString("yy") & "0000")
Next
GridView1.DataSource = ds.Tables("ovst")
GridView1.DataBind()
End Sub
End Class
Dim ci As New System.Globalization.CultureInfo("en-US")
'ถ้า พศ. เปลี่ยนเป็น th-TH
For Each d As DataRow In ds.Tables("ovst").Rows
Dim vstDate As Date = CType(d("vstDate"), Date)
d("vstDate") = vstDate.ToString("yyyy-MM-dd", ci)
Next
GridView1.DataSource = ds.Tables("ovst")