| | |
How to Search record from the Sql Server Database
Please support our ASP.NET advertiser: Intel Parallel Studio Home
Thread Solved |
•
•
•
•
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
ASP.NET Syntax (Toggle Plain Text)
Dim strSQL as String strSQL = "SELECT Field1, Field2 FROM tbltemp WHERE Field1 = '" & TextBox1.Text & "'"
Hope this helps.
•
•
Join Date: Sep 2006
Posts: 17
Reputation:
Solved Threads: 0
•
•
•
•
pseudo_code:
ASP.NET Syntax (Toggle Plain Text)
Dim strSQL as String strSQL = "SELECT Field1, Field2 FROM tbltemp WHERE Field1 = '" & TextBox1.Text & "'"
Hope this helps.
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.
•
•
Join Date: Oct 2006
Posts: 8
Reputation:
Solved Threads: 1
•
•
•
•
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
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:
When passing query use parameters:
To hide some element while print:
http://www.daniweb.com/techtalkforums/thread54946.html
•
•
•
•
cmd.CommandText = "SELECT ID, Title, Job FROM Jobs WHERE Title=@Title"
cmd.Parameters.Add("@Title", SqlDataType.NVarChar).Value = Me.txtTitle.Text.Trim
http://www.daniweb.com/techtalkforums/thread54946.html
Last edited by ManicCW; Oct 3rd, 2006 at 3:07 am.
•
•
Join Date: Apr 2007
Posts: 3
Reputation:
Solved Threads: 0
•
•
•
•
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
![]() |
Similar Threads
- connecting to sql server database using C++ program (C++)
- Help needed: Connecting to sql server database (VB.NET)
- Connecting to a SQL Server Database using VB (VB.NET)
- Sql Server Database Connector (JSP)
- Simple ASP.Net Login Page (Using VB.Net) (ASP.NET)
- sql server connection (ASP)
Other Threads in the ASP.NET Forum
- Previous Thread: Search an access database
- Next Thread: Empty gridview
| Thread Tools | Search this Thread |
Tag cloud for ASP.NET
.net 2.0 ajax alltypeofvideos anathor appliances application asp asp.net bc30451 beginner box browser button c# cac checkbox commonfunctions control dataaccesslayer database datagridview datalist deployment development dgv dialog dropdownlist dynamic dynamically edit editing embeddingactivexcontrol expose feedback fileuploader fill findcontrol flash form formatdecimal formview google gridview gudi iis image javascript list listbox login microsoft mobile mouse mssql news novell numerical opera panelmasterpagebuttoncontrols parent project radio redirect registration relationaldatabases reportemail richtextbox rows schoolproject search security select sessionvariables silverlight smoobjects software sql-server sqlserver2005 ssl suse textbox tracking treeview unauthorized validatedate validation vb.net video videos vista visualstudio web webapplications webdevelopemnt webdevelopment webprogramming webservice xsl youareanotmemberofthedebuggerusers





