I'm using Vb.net 2012 with sql as backhand. This is my sql server database table its name is "Timetable"
__________________________ Name | Course | _____|___________________| a | DTP Flash AutoCad |(All these are courses with space between each courses) b | PHP Asp C# | c | Flash WebDesigning| _____|___________________|
I am running this sql query
Private Sub TxtName_TextChanged(sender As Object, e As EventArgs) Handles TxtName.TextChanged
Try
Dim txt As Integer = Val(Len(TxtName.Text))
MsgBox(Val(txt))
Dim str As String = "select FName, SurName,Courses,TotalFees,Balance,TotalDuration,DOA,DOC,Status,Time,ContactNo,ONo from TimeTable where FName='" & TxtName.Text & "' or Courses= SUBSTRING('" & TxtName.Text & "',0,50)"
Dim ds As New DataSet
adp = New SqlDataAdapter(str, cn)
adp.Fill(ds)
DataGridView1.DataSource = Nothing
DataGridView1.Refresh()
DataGridView1.DataSource = ds
DataGridView1.DataSource = ds.Tables(0)
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
The data is displayed in gridview when searched with name
But when I write the course name with substring it doesn't displays me... I have to write whole course name.... i.e "DTP Flash AutoCad".
I want that if user types DTP it displays the data, even though the row contains
DTP Flash AutoCad.