Displaying selected values only in VB6

前端 未结 1 625
渐次进展
渐次进展 2021-01-29 10:07

I am trying to display students in a datagrid that have \"yes\" as active. If the student has \"no\" as active, the form has to hide it and only show the students with \"yes\".

相关标签:
1条回答
  • 2021-01-29 10:37

    What is Active?
    If Active is Boolean data type (Yes/No), it's optional values are True or False. In that case your query is:

    "select * from Table1 where Active <> False"
    

    If Active is String data type; are 'no' and 'No' the same values? you are better converting all to lower or upper case:

    "select * from Table1 where Ucase(Active) <> 'NO'"
    

    Edit: Modified Code

    Dim sql As String
    
    sql = "select * from Table1 where [Active] <> 'No'"
    Adodc1.ConnectionString = conn.connstr
    Adodc1.CommandType = adCmdText
    Adodc1.RecordSource = sql
    Set StudentTable.DataSource = Adodc1
    Adodc1.Refresh
    Adodc1.Visible = False
    
    0 讨论(0)
提交回复
热议问题