0
我嘗試構建與數據庫綁定的下拉列表。我發現了一些我沒有發現的錯誤。請幫助,下面是我的代碼。如何建立與數據庫的下拉列表?
strSQL = "SELECT distinct table1.DeptName FROM Table1 " & _
"FULL JOIN Table2 on table1.DeptName = Table2.deptname" & _
"FULL JOIN Table3 on Table1.deptname = table3.DeptName " & _
"Where table1.deptname is not null order by table1.deptname "
Common.OpenConn()
Common.execReader(strSQL, params, dt, Common.txn)
If dt.Rows.Count > 0 Then
DropDownListDept.DataSource = dt
DropDownListDept.DataTextField = "DeptName"
DropDownListDept.DataValueField = "DeptName"
DropDownListDept.DataBind()
DropDownListDept.Items.Insert(0, New ListItem("Select Department Name", "0"))
End If
發現錯誤
無效的列名稱DeptNameFULL「。
謝謝。它工作。 – user3759016