Dim sqlMin01 As String
sqlMin01 = "SELECT Min(SeatID) FROM Seat"
sqlMin01 &= " WHERE GdtID IN (SELECT GdtID FROM Graduate WHERE EdtID = 0235 AND GdtHonor = 3)"
Da1 = New SqlDataAdapter(sqlMin01, Conn)
Da1.Fill(Ds1, "Min01")
' lblAnSeatIDH101.DataBindings.Add("Text", Ds1, "Min01.Min01")
Column 'Min01' does not belong to table AnEdtName102.
ผิดตรงไหนครับ
Code (VB.NET)
Dim sqlMin01 As String
sqlMin01 = "SELECT Min(SeatID) FROM Seat"
sqlMin01 &= " WHERE GdtID IN (SELECT GdtID FROM Graduate WHERE EdtID = 0235 AND GdtHonor = 3)"
Dim sqlMax01 As String
sqlMax01 = "SELECT MAX(SeatID) FROM Seat"
sqlMax01 &= " WHERE GdtID IN (SELECT GdtID FROM Graduate WHERE EdtID = 0235 AND GdtHonor = 3)"
Da1 = New SqlDataAdapter(sqlMin01, Conn)
Da1.Fill(Ds1, "Min01")
Da2 = New SqlDataAdapter(sqlMax01, Conn)
Da2.Fill(Ds2, "Max01")
lblAnSeatIDH101.Text = Ds1.Tables(0).Rows(0)("Min01")
lblAnSeatIDH102.Text = Ds2.Tables(0).Rows(0)("Max01")