我的代码没有向数据库添加组合框值。这里可能有什么问题?
private void Submit_Click(object sender, EventArgs e)
{
string connectionString = @"Data Source=CEX-PC\SQLEXPRESS;"
+ "Initial Catalog=inventorydatabase;"
+ "Integrated Security=True";
SqlConnection con = new SqlConnection(connectionString);
con.Open();
string query
= "INSERT INTO userdetail (username, password, position) VALUES ('"
+ username.Text + "', '" + password.Text + "', '"
+ position.SelectedValue + "' )";
SqlCommand command = new SqlCommand(query, con);
command.ExecuteNonQuery();
con.Close();
}