我在 SQL Server CE 中的插入操作有问题,这是例外
这些是我的代码:
private void button1_Click(object sender, EventArgs e)
{
try
{
perintahsql = new SqlCeCommand("INSERT INTO lokasi (Campus, Address, Phone 1, Phone 2, Phone 3, Fax, Ext.number, Longitude, Latitude, Maps) VALUES (@Campus, @Address, @Phone 1, @Phone 2, @Phone 3, @Fax, @Ext.number, @Longitude, @Latitude, @Maps)", koneksi);
perintahsql.Parameters.AddWithValue("@Campus", comboBox1.Text);
perintahsql.Parameters.AddWithValue("@Address", textBox1.Text);
perintahsql.Parameters.AddWithValue("@Phone 1", textBox2.Text);
perintahsql.Parameters.AddWithValue("@Phone 2", textBox3.Text);
perintahsql.Parameters.AddWithValue("@Phone 3", textBox4.Text);
perintahsql.Parameters.AddWithValue("@Fax", textBox5.Text);
perintahsql.Parameters.AddWithValue("@Ext. number", textBox6.Text);
perintahsql.Parameters.AddWithValue("@Longitude", textBox7.Text);
perintahsql.Parameters.AddWithValue("@Latitude", textBox8.Text);
perintahsql.Parameters.AddWithValue("@Maps", textBox9.Text);
koneksi.Open();
perintahsql.ExecuteNonQuery();
koneksi.Close();
}
catch (SqlCeException ex)
{
MessageBox.Show("Whoopss!! " + ex, "SQL Server CE Exception Message");
}
}
如何修复该错误?谢谢你。