Quantcast
Channel: ฟอรัม Getting started with SQL Server
Viewing all articles
Browse latest Browse all 8428

Data Search In SQL Database

$
0
0

 

Hi, i want user to type a string in textbox, and i will search, if textbox.text exists in my SQL database table or not. Below is the code i'm using :---------------

 

 string txtname = (txtEmpName.Text).Trim();

 sQuery = "select * from tbUser where UserName='_username'";
 sQuery = sQuery.Replace("_username", txtname);
 SqlConnection objConnection = new SqlConnection(source);
 objDataAdapter = new SqlDataAdapter(sQuery,objConnection);
// DataTable dtTable = new DataTable();
 if (objConnection.State  == ConnectionState.Closed)
 objConnection.Open();
 objDataSet = new DataSet();
 objDataAdapter.Fill(objDataSet);
// objDataAdapter.Fill(dtTable);

 

or i want to search if "txtname" exists in "tbUser" table.

 

Thanks & Regards.

 

Manish S. Anand


Viewing all articles
Browse latest Browse all 8428

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>