您好,我仍然收到此错误,我尝试了不同的解决方案,但它不起作用!这是我的代码
我将连接字符串放在 app.config 文件中,如下所示:
<connectionStrings>
<add name="ComputerManagement"
connectionString= "Provider=Microsoft.ACE.OLEDB.12.0; Data Source=.. ; Integrated Security=false"/>
并在表单中的 button_click 中输入以下代码:
try
{
OleDbConnection conn = new OleDbConnection(GetConnectionString());
OleDbCommand command = new OleDbCommand();
command.CommandType = CommandType.Text;
command.CommandText = "INSERT INTO Clients(C_name,C_phone ,C_mob ,C_add , C_email ,C_account) VALUES ('" + textBox1.Text + "','" + textBox2.Text + "','" + textBox3.Text + "','" + textBox4 + "','" + textBox5.Text + "','" + textBox6.Text + "')";
command.Connection = conn;
conn.Open();
command.ExecuteNonQuery();
conn.Close();
}
catch (Exception) { throw; }