private void button1_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(conString);
con.Open();
int tableID;
int customerID;
customerID = Convert.ToInt32(dataGridView2.SelectedCells[0].Value.ToString());
tableID = Convert.ToInt32(dataGridView1.SelectedCells[0].Value.ToString());
SqlCommand cmd = con.CreateCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = "select * from Reservationn where TableID='" + tableID+ "CustomerID='"+ customerID +"Capacity='" + textBox2.Text + "Date='"+textBox5.Text+"HourEnd='"+comboBox1.Text+"Reservİnfo='"+textBox6.Text + "'";
cmd.ExecuteNonQuery();
DataTable dt = new DataTable();
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(dt);
dataGridView3.DataSource = dt;
con.Close();
}
: 은 하나 이상의 데이터에 대해 SQL 쿼리를 작성하는 방법은 무엇입니까? 문제가에있다
cmd.CommandText = "select * from Reservationn where TableID='" + tableID+ "CustomerID='"+ customerID +"Capacity='" + textBox2.Text + "Date='"+textBox5.Text+"HourEnd='"+comboBox1.Text+"Reservİnfo='"+textBox6.Text + "'";
는
는 어떻게이
을 고정 할 수 있습니다 ?
정확히 문제는 무엇인가? (Plutonix 주석 제외) –