C# Programming
04-07-2012, 02:40 AM
i use this code
SqlCommand cmd1 = new SqlCommand("insert into '" + comboBox6.SelectedItem.ToString() + "' (name,address,telephone,website,email,info,place_id,cor_x,cor_y)values(" + "'" + textBox_name.Text + "','" + textBox_address.Text + "','" + textBox_telephone.Text + "','" + textBox_website.Text + "','" + textBox_email.Text + "','" + richTextBox_info.Text + "' , select id from places where name= '"+ comboBox6.SelectedItem.ToString() +"','" + textBox_corx.Text + "','" + textBox_cory.Text + "') ", con);
and this error showed
Incorrect syntax near the keyword 'select'.
Incorrect syntax near ','.
what should i do ?
SqlCommand cmd1 = new SqlCommand("insert into '" + comboBox6.SelectedItem.ToString() + "' (name,address,telephone,website,email,info,place_id,cor_x,cor_y)values(" + "'" + textBox_name.Text + "','" + textBox_address.Text + "','" + textBox_telephone.Text + "','" + textBox_website.Text + "','" + textBox_email.Text + "','" + richTextBox_info.Text + "' , select id from places where name= '"+ comboBox6.SelectedItem.ToString() +"','" + textBox_corx.Text + "','" + textBox_cory.Text + "') ", con);
and this error showed
Incorrect syntax near the keyword 'select'.
Incorrect syntax near ','.
what should i do ?