Vb datalist does not display the data after the data binding
Time:11-25
Private Sub Form_Load () If cn. State=adStateOpen Then The Else Cn. Open the STR End the If SQL="select pid, psnname from PSN" If the rs. State=adStateOpen Then rs. Close Rs. CursorLocation=adUseClient Rs. The open SQL, cn, 1, 1 If the rs. BOF=True And rs. EOF=True Then The Exit Sub The Else With DataList1 Set the RowSource=rs Set the DataSource=rs . BoundColumn=rs. Fields (0). The Name . ListField=rs. Fields (1). The Name End With If cn. State=adStateOpen Then cn. Close If the rs. State=adStateOpen Then rs. Close The Set cn=Nothing Set the rs=Nothing End the If End Sub
CodePudding user response:
Personal experience, don't the whole data binding, all kinds of pit, and the pit to meet is not the beginning, Suggest write a function, iterate over the data set to control with the data, abundant oneself start work, and have what problem or have what personalized needs also flexible,