Fejl ved INSERT
Hvorfor vil denne INSERT ikke:string connection = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=~/_Status.mdb";
string sqlString = "INSERT INTO T_Status ( Program, Tekst ) VALUES ('" + TextBox1.Text.ToString() + "', '" + TextBox2.Text.ToString() + "')";
//string sqlString = "INSERT INTO `T_Status` (``,`Program`, `Tekst`) VALUES (``,`"+TextBox1.Text.ToString()+"`, `"+TextBox2.Text.ToString()+"`)";
System.Diagnostics.Debug.WriteLine("\n***\n"+sqlString+"\n***\n");
OleDbConnection con = new OleDbConnection(connection);
OleDbCommand command = new OleDbCommand(sqlString, con);
try
{
con.Open();
command.ExecuteNonQuery();
}
catch (Exception exc)
{
Console.WriteLine("Fejl: "+exc.Message);
}
finally {
con.Close();
}
Selve sql'en er god nok, for hvis jeg afvikler den inde i Access, så kommer den ind.
