|
 |
|
ขอคำแนะนำในการแสดงวันที่บน gridview ตอนนี้ดิฉันทำ Gridview ให้มีการดึงข้อมูลเกี่ยวกับรหัส ,ชื่อ, วันที่ยืมและวันที่จะคืนหนังสือ |
|
 |
|
|
 |
 |
|
การ Query ค่า อันนี้กวางไม่แน่ใจเท่านั้นนะคะ แต่ลองดูนะคะ เผื่อจะใช้ได้ ดัดแปลงดู
Code (VB.NET)
Dim da As SqlDataAdapter = New SqlDataAdapter
Dim ds As DataSet = New DataSet
Dim st As String = "insert รหัส ,ชื่อ, วันที่ยืม, วันที่จะคืนหนังสือ from ตารางที่ต้องการเรียกข้อมูล where วันที่จะคืนหนังสือ = date.today"
da = New SqlDataAdapter(st, SqlConnection1)
da.Fill(ds, "ชื่อตาราง")
DataGridView1.DataSource = ds.Tables("ชื่อตาราง")
With DataGridView1
.Columns("รหัส").DisplayIndex = 0
.Columns(0).HeaderText = "รหัส"
.Columns(0).Width = 50%
.Columns(0).ReadOnly = True
.Columns("ชื่อ").DisplayIndex = 1
.Columns(1).HeaderText = "ชื่อ"
.Columns(1).Width = 100%
.Columns(1).ReadOnly = True
.Columns("วันที่ยืม").DisplayIndex = 2
.Columns(2).HeaderText = "วันที่ยืม"
.Columns(2).Width = 100%
.Columns(2).ReadOnly = True
.Columns("วันที่จะคืนหนังสือ").DisplayIndex = 3
.Columns(3).HeaderText = "วันที่จะคืนหนังสือ"
.Columns(3).Width = 50%
.Columns(3).ReadOnly = True
end with
หวังว่าจะช่วยได้นะคะ
|
 |
 |
 |
 |
Date :
2010-02-04 19:08:55 |
By :
Kwang196 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ขอบคุณสำหรับคำแนะนำนะคะ แต่ที่ดิฉันต้องการคือดึงข้อมูลจากฐานข้อมูล โดยมีเงื่อนไขว่าจะต้องเป็นวันที่ปัจจุบัน ถึงถ้าในฐานข้อมูลของวันที่คืนนั้นมีวันที่คืนตรงกับวันปัจจุบันก็ให้แสดงข้อมูลออกมานะคะ
|
 |
 |
 |
 |
Date :
2010-02-05 10:01:23 |
By :
tree1234 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ตอนนี้สามารถแสดงผลได้ตามที่ต้องการแล้วค่ะ คือใช้
คำสั่ง sql คือ
SELECT * FROM TB_BOOK WHERE END_DATE = CONVERT(varchar, GETDATE(), 111)
ค่ะ
|
 |
 |
 |
 |
Date :
2010-02-05 11:45:36 |
By :
tree1234 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 01
|