F
F
fokin_nikolay19892015-07-23 14:42:02
SQL
fokin_nikolay1989, 2015-07-23 14:42:02

How to substitute value from textbox1 into sql query c#?

Help how to make so that from textbox1 the parameter would be substituted in sql query c#
SqlParameter myParam2 = new SqlParameter("@Param2", textBox1.Text);
FbCommand cmd = new FbCommand("SELECT * FROM OSP_VERSIONS WHERE OSP_SYSTEM_SITE_ID > @Param2", fbConn);
cmd.Parameters.AddWithValue(myParam2);
for me it looks like this (((but it doesn't work for some reason ((((((((((((((

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Kovalsky, 2015-07-23
@dmitryKovalskiy

1) Remove sad emoticons, 2) Slap yourself with a ruler on your hands for a direct request to the database with an asterisk.
3) Create a stored procedure in the database that takes 1 input parameter and returns a set of columns you need using SELECT (even if you need all of them - rewrite reverently with a comma). 4) rewrite the code to call the storage with parameters.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question