我有一個關於在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");
}
}
如何解決那個錯誤?謝謝。
把消解點和檢查哪個代碼行拋出那個錯誤 –