943,712 Members | Top Members by Rank

Ad:
  • ASP.NET Discussion Thread
  • Marked Solved
  • Views: 12990
  • ASP.NET RSS
Sep 16th, 2006
0

How to Search record from the Sql Server Database

Expand Post »
i am developing a job site and i require to search for records from the database. i m passing value fro that parameter in textbox.
so please help me
thanks in advance
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Dhruv Shah is offline Offline
17 posts
since Sep 2006
Sep 17th, 2006
0

Re: How to Search record from the Sql Server Database

Click to Expand / Collapse  Quote originally posted by Dhruv Shah ...
i am developing a job site and i require to search for records from the database. i m passing value fro that parameter in textbox.
so please help me
thanks in advance
pseudo_code:
ASP.NET Syntax (Toggle Plain Text)
  1. Dim strSQL as String
  2.  
  3. strSQL = "SELECT Field1, Field2 FROM tbltemp WHERE Field1 = '" & TextBox1.Text & "'"

Hope this helps.
Team Colleague
Reputation Points: 211
Solved Threads: 27
Master Poster
Paladine is offline Offline
793 posts
since Feb 2003
Sep 17th, 2006
0

Re: How to Search record from the Sql Server Database

Click to Expand / Collapse  Quote originally posted by Paladine ...
pseudo_code:
ASP.NET Syntax (Toggle Plain Text)
  1. Dim strSQL as String
  2.  
  3. strSQL = "SELECT Field1, Field2 FROM tbltemp WHERE Field1 = '" & TextBox1.Text & "'"

Hope this helps.
thanks sir
this help me out. but when i m printing the record it also shows me textbox and command button. So sir now how do i remove this from print out.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Dhruv Shah is offline Offline
17 posts
since Sep 2006
Oct 3rd, 2006
0

Re: How to Search record from the Sql Server Database

Click to Expand / Collapse  Quote originally posted by Dhruv Shah ...
i am developing a job site and i require to search for records from the database. i m passing value fro that parameter in textbox.
so please help me
thanks in advance
TRY THIS WITH ASP.NET USING VB.NET:

Private Sub btnsearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnsearch.Click
Try
txtmsg.Text = ""
OleDbDataAdapter1 = New OleDbDataAdapter("select * from phbook where name like '" & ddl.SelectedItem.Text & "%'", OleDbConnection1)
OleDbDataAdapter1.Fill(DataSet21, "phbook")
OleDbConnection1.Open()
Dim com As New OleDbCommand
com.Connection = OleDbConnection1
com.CommandText = "select * from phbook"
dg1.DataBind()
Catch ex As Exception
txtmsg.Text = ex.ToString
OleDbConnection1.Close()
End Try
End Sub

THIS WILL SEARCH THE TEXT AND ONLY CHECKING THE FIRST LETTER OF THE GIVEN TEXT:

LIKE IF U WRITE "J" YHEN UT WILL SEARCH EVERY TEXT STARTING WITH THE LETTER J......

I HOPE THIS WILL HELP:cheesy:
Reputation Points: 10
Solved Threads: 1
Newbie Poster
Blah Blah is offline Offline
8 posts
since Oct 2006
Oct 3rd, 2006
0

Re: How to Search record from the Sql Server Database

When passing query use parameters:
Quote ...
cmd.CommandText = "SELECT ID, Title, Job FROM Jobs WHERE Title=@Title"
cmd.Parameters.Add("@Title", SqlDataType.NVarChar).Value = Me.txtTitle.Text.Trim
To hide some element while print:
http://www.daniweb.com/techtalkforums/thread54946.html
Last edited by ManicCW; Oct 3rd, 2006 at 3:07 am.
Reputation Points: 12
Solved Threads: 11
Junior Poster in Training
ManicCW is offline Offline
95 posts
since Nov 2005
Apr 4th, 2007
0

Re: How to Search record from the Sql Server Database

Click to Expand / Collapse  Quote originally posted by Blah Blah ...
TRY THIS WITH ASP.NET USING VB.NET:

Private Sub btnsearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnsearch.Click
Try
txtmsg.Text = ""
OleDbDataAdapter1 = New OleDbDataAdapter("select * from phbook where name like '" & ddl.SelectedItem.Text & "%'", OleDbConnection1)
OleDbDataAdapter1.Fill(DataSet21, "phbook")
OleDbConnection1.Open()
Dim com As New OleDbCommand
com.Connection = OleDbConnection1
com.CommandText = "select * from phbook"
dg1.DataBind()
Catch ex As Exception
txtmsg.Text = ex.ToString
OleDbConnection1.Close()
End Try
End Sub

THIS WILL SEARCH THE TEXT AND ONLY CHECKING THE FIRST LETTER OF THE GIVEN TEXT:

LIKE IF U WRITE "J" YHEN UT WILL SEARCH EVERY TEXT STARTING WITH THE LETTER J......

I HOPE THIS WILL HELP:cheesy:

i try using this sample code to my application.but if you dont mind, can you state the namesapece of DATA declarations for connection n data type to match with this code.

tq
Reputation Points: 10
Solved Threads: 0
Newbie Poster
june_bunga is offline Offline
3 posts
since Apr 2007
Nov 24th, 2008
0

Re: How to Search record from the Sql Server Database

please send me the c# sharp code ..
i am developing the application using the c# (same project i am doing like job portal)]
please send me ASAp
Reputation Points: 10
Solved Threads: 0
Newbie Poster
krany18 is offline Offline
19 posts
since Nov 2008

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP.NET Forum Timeline: Search an access database
Next Thread in ASP.NET Forum Timeline: Empty gridview





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC