Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Creating a search function in VB.net

Reply
Thread Tools

Creating a search function in VB.net

 
 
=?Utf-8?B?RGFuaWVs?=
Guest
Posts: n/a
 
      02-26-2007
Dear All

I need some help. I've got a deadline for this friday and i'm stuck. what
i'm trying to do is have 1 textbox, datagrid and 1 button then when the user
enter a search string, and press the button, I want the result to be
displayed in the datagrid.

At the moment, when the user press the button the system checks if there is
any text in the text box, if there isn’t then it calls the BindDataGrid2()
function which displays everything that’s in the table .

So basically I’m not able to use the value that is in the textbox to make a
custom query.

Please help me

Thank you
Dan

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim mun As String
Dim textBinding As String
Dim Mark As String



' filter = TextBox1.Text

If TextBox1.Text = "" Then
BindDataGrid2()
' DataGrid2.Visible = False
Else



textBinding = TextBox1.Text


Dim strSQL As String = _
"SELECT * FROM ChangeLog where ChangeDetails = 'textBinding'"


With DataGrid2
' Set the DataKeyField so that the DataKeys collection is
filled and
' usable in the ItemCommand event handler. See further
comments in
' grdCustomers_ItemCommand(), above.
.DataKeyField = "ChangeID"
.DataSource = CreateDataSet(strSQL)
.DataBind()
End With
End If



End Sub

' This routine calls CreateDataSet and binds the Customers DataGrid to
the
' return value.

' This routine calls CreateDataSet and binds the Customers DataGrid to
the
' return value.
Sub BindDataGrid2()
Dim textBinding As String
Dim mun As String

textBinding = TextBox1.Text
' textBinding = pete

Dim strSQL As String = _
"SELECT * FROM ChangeLog "
'where ChangeDetails = mun"


With DataGrid2
' Set the DataKeyField so that the DataKeys collection is filled
and
' usable in the ItemCommand event handler. See further comments
in
' grdCustomers_ItemCommand(), above.
.DataKeyField = "ChangeID"
.DataSource = CreateDataSet(strSQL)
.DataBind()
End With
End Sub

 
Reply With Quote
 
 
 
 
Alexey Smirnov
Guest
Posts: n/a
 
      02-26-2007
On Feb 26, 2:44 pm, Daniel <Dan...@discussions.microsoft.com> wrote:
> Dear All
>
> I need some help. I've got a deadline for this friday and i'm stuck. what


Great... you have some time

"SELECT * FROM ChangeLog where ChangeDetails = '" & textBinding & "'"

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating user input Search with 3rd party search engines phl ASP .Net 0 02-19-2008 05:11 PM
| SEO , Search Engine Optimizer, SEARCH OPtiMIzAtIoN with SeaRch OPtiMizer optimizer.seo@gmail.com Digital Photography 0 04-22-2007 04:20 AM
write a function such that when ever i call this function in some other function .it should give me tha data type and value of calling function parameter komal C++ 6 01-25-2005 11:13 AM
Search Bar not displaying search Engines Zimran Douglas Firefox 1 01-07-2005 02:30 PM
search within a search within a search - looking for better way...my script times out Abby Lee ASP General 5 08-02-2004 04:01 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57