Private Sub TextBoxX3_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBoxX3.TextChanged Dim objcmd As SqlCommand Dim sql As String If CheckBoxX2.Checked = True Then sql = "select * from leitnertable where word like '%" & TextBoxX3.Text & "%'" End If If CheckBoxX1.Checked = True Then sql = "select * from leitnertable where firstmeaning or secondmeaning like '%" & TextBoxX3.Text & "%'" End If objcmd = New SqlCommand(sql, con) If objcmd.Connection.State = ConnectionState.Closed Then objcmd.Connection.Open() Dim dr As SqlDataReader dr = objcmd.ExecuteReader While dr.Read Dim dt As New DataTable dt.Load(dr) DataGridView2.DataSource = dt End While End Sub
DataReader.Read
Command.ExecuteReader
DataTable.Load
DataReader
objcmd = New SqlCommand(sql,con)
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)