Im working on my first useable practice app to help people I work with run simple queries without having to know SQL.
I have a simple form, with 4 textbox entries. columns, table, condition column, condition
what I am wanting is to run the query without the where statement if the condition column is blank, or run the conditional statement if there is something there.
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles CMDQuery.Click
    If Columntxtbox.Text <> "" Then
        If SQL.HasConection = True Then
            If Conditioncolumntxtbox.Text = "" Then
                SQL.runquery("Select " & Columntxtbox.Text & " from " & tabletxtbox.Text)
            Else
                SQL.runquery("Select " & Columntxtbox.Text & " from " & tabletxtbox.Text & " Where " & Conditioncolumntxtbox.Text & " like'%" & conditiontxtbox.Text & "%'")
                If SQL.sqldataset.Tables.Count > 0 Then
                    DGVData.DataSource = SQL.sqldataset.Tables(0)
                End If
            End If
        End If
    End If
End Sub
what's happening is when I fill out all the fields, it works fine, when I try to enter just the column and table field, nothing happens. I'm thinking it has to do with the third If (if I change the = to <> then I get error with keyword like when column and city is filled and nothing when all are filled ) any help would be appreciated
thanks
 
     
     
    