Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim strConn As String
Dim sqluername As String
strConn = WebConfigurationManager.ConnectionStrings("conn").ConnectionString
Dim Conn As New SqlConnection(strConn)
Conn.Open()
sqluername = "SELECT name_drug, mode, sum(quantity) As total_quantity FROM drug, mode WHERE drug.id_mode = mode.id_mode GROUP BY name_drug HAVING sum(quantity) <= 2 order by total_quantity "
Dim da As New SqlDataAdapter(sqluername, Conn)
Dim ds As New DataSet
da.Fill(ds, "drug")
GridView1.DataSource = ds.Tables("drug")
GridView1.DataBind()
End Sub
โดย มัน Error ว่า Column 'mode.mode' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause. คับ