Reputation: 205
how to call an asp parameter in a sql command exp:
cmd.CommandText = "SELECT name FROM server WHERE code="+TextBox1.Text;
is it correct? .
Upvotes: 0
Views: 1408
Reputation: 1062502
(tries and fails to suppress a shudder)
cmd.CommandText = "SELECT name FROM server WHERE code=@code";
cmd.Parameters.AddWithValue("code", TextBox1.Text);
otherwise, you are just ripe for SQL injection.
Upvotes: 6