Присвоить введенное значение texbox SQL query |C# application|oracle
assign entered texbox value to Sql query |C#|Oracle **How do i assign the Textbox value to my SQL Query C#** [C# Application UI][1][1]: https://i.stack.imgur.com/8Pzl7.jpg In the Above Image i typed Tablename = PERSONDETAILS this entered value in textBox1.Text should be passed to my SQL Query as a Paramter.So Hard coding the table name in the SQl query will be reduced Actual code where i want it to be Included "select * from all_all_tables WHERE table_name='PERSONSDETAILS'"; **code :** string conString = "User Id=hr;Password=hr;Data Source=localhost:1522/orcl.168.0.5;"; OracleConnection con = new OracleConnection(); con.ConnectionString = conString; con.Open(); OracleCommand cmd = con.CreateCommand(); cmd.CommandText = "select * from all_all_tables WHERE table_name='PERSONSDETAILS'"; OracleDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { readtext.Text = reader.GetString(0); } con.Close();
Что я уже пробовал:
я попытался добавить textbox1.Text.toString() вместо table_name
аргумент table_name='"+текстовое поле textbox1.Текст.метод toString()+"'
но это не работает как передать введенное значение текстового поля в качестве параметра sql запросу