HEY im trying to take input from textbox and then i want to run a query in query in want to search that value
suppose my textbox name is txtInput.text
n query which i want to run
Code:
string connectionString = "Data Source =USER-PC\\SQLEXPRESS1;Initial Catalog=inFlowInventory; Integrated Security=SSPI";
using (SqlConnection testConnection = new SqlConnection(connectionString))
{
SqlCommand testCommand =
new SqlCommand("SELECT customer FROM Customer where customer =txtInput.Text", testConnection);
testConnection.Open();
SqlDataReader sqlDr =testCommand.ExecuteReader(CommandBehavior.CloseConnection);
if (sqlDr.HasRows)
{
foreach (DbDataRecord rec in sqlDr)
{
dbRecordHolder.Add(rec);
}
}
CustomerNameGrid.DataSource = dbRecordHolder;
}