How to Search record from the Sql Server Database

Please support our ASP.NET advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: Sep 2006
Posts: 17
Reputation: Dhruv Shah is an unknown quantity at this point 
Solved Threads: 0
Dhruv Shah Dhruv Shah is offline Offline
Newbie Poster

How to Search record from the Sql Server Database

 
0
  #1
Sep 16th, 2006
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
Reply With Quote Quick reply to this message  
Join Date: Feb 2003
Posts: 793
Reputation: Paladine has a spectacular aura about Paladine has a spectacular aura about Paladine has a spectacular aura about 
Solved Threads: 27
Team Colleague
Paladine's Avatar
Paladine Paladine is offline Offline
Master Poster

Re: How to Search record from the Sql Server Database

 
0
  #2
Sep 17th, 2006
Originally Posted by Dhruv Shah View 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
pseudo_code:
  1. Dim strSQL as String
  2.  
  3. strSQL = "SELECT Field1, Field2 FROM tbltemp WHERE Field1 = '" & TextBox1.Text & "'"

Hope this helps.
Assistant Manager, Pharmacy Informatics
Wordpress Learning Blog
Updated : ASP.Net Login Code
Reply With Quote Quick reply to this message  
Join Date: Sep 2006
Posts: 17
Reputation: Dhruv Shah is an unknown quantity at this point 
Solved Threads: 0
Dhruv Shah Dhruv Shah is offline Offline
Newbie Poster

Re: How to Search record from the Sql Server Database

 
0
  #3
Sep 17th, 2006
Originally Posted by Paladine View Post
pseudo_code:
  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.
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 8
Reputation: Blah Blah is an unknown quantity at this point 
Solved Threads: 1
Blah Blah Blah Blah is offline Offline
Newbie Poster

Re: How to Search record from the Sql Server Database

 
0
  #4
Oct 3rd, 2006
Originally Posted by Dhruv Shah View 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
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:
Reply With Quote Quick reply to this message  
Join Date: Nov 2005
Posts: 95
Reputation: ManicCW is an unknown quantity at this point 
Solved Threads: 11
ManicCW's Avatar
ManicCW ManicCW is offline Offline
Junior Poster in Training

Re: How to Search record from the Sql Server Database

 
0
  #5
Oct 3rd, 2006
When passing query use parameters:
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.
Reply With Quote Quick reply to this message  
Join Date: Apr 2007
Posts: 3
Reputation: june_bunga is an unknown quantity at this point 
Solved Threads: 0
june_bunga june_bunga is offline Offline
Newbie Poster

Re: How to Search record from the Sql Server Database

 
0
  #6
Apr 4th, 2007
Originally Posted by Blah Blah View Post
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
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 19
Reputation: krany18 is an unknown quantity at this point 
Solved Threads: 0
krany18 krany18 is offline Offline
Newbie Poster

Re: How to Search record from the Sql Server Database

 
0
  #7
Nov 24th, 2008
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
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC