How I can change my code, so I can search for specific columns of my table?
I want to write the request's column values in TextBoxes, and then execute the request when I press a Button.
private async void button26_Click(object sender, EventArgs e)
{
if (label77.Visible) label77.Visible = false;
if (!string.IsNullOrEmpty(textBox62.Text) && !string.IsNullOrEmpty(textBox62.Text))
{
SqlCommand command = new SqlCommand("INSERT INTO [Policlinic] ('id_Policlinic', 'Name', 'Address', 'Phone') VALUES (" + textBox62 + ", '" + textBox62 + "', '" + textBox62 + "','" + textBox62 + "')", sqlConnection);
command.Parameters.Add("@id_Policlinic", SqlDbType.Int); command.Parameters["@id_Policlinic"].Value = Convert.ToInt32(textBox62.Text, 4);
command.Parameters.AddWithValue("Name", textBox62.Text);
command.Parameters.AddWithValue("Address", textBox62.Text);
command.Parameters.AddWithValue("Phone", textBox62.Text);
await command.ExecuteNonQueryAsync();
}
else
{
label77.Visible = true;
label77.Text = "Поля должны быть заполнены!";
}
}
Any thoughts?