string sqlInsert = "INSERT INTO Transaction " +
"(VIN, Price, TranDate, TranType) " +
"VALUES('" + VIN + "', '" + price + "', '" + aDate + "', '" + transType + "')";
// check SQL string in Output window for debugging
Console.WriteLine(sqlInsert);
myDataAdapter = new OleDbDataAdapter();
//insert new account into database
try
{
myDataAdapter.InsertCommand = new OleDbCommand(sqlInsert);
myAccessConn = ConnectionClass.getConnection();
if (myAccessConn.State == ConnectionState.Closed)
{
myAccessConn.Open();
}
myDataAdapter.InsertCommand.Connection = myAccessConn;
myDataAdapter.InsertCommand.ExecuteNonQuery();
}
catch (Exception e)
{
Console.WriteLine("Error: Insert in DA failed");
Console.WriteLine(e);
}
coop123 0 Newbie Poster
finito 46 Nearly a Posting Virtuoso
coop123 0 Newbie Poster
coop123 0 Newbie Poster
finito 46 Nearly a Posting Virtuoso
finito 46 Nearly a Posting Virtuoso
kvprajapati 1,826 Posting Genius Team Colleague
powerbox 13 Light Poster
finito 46 Nearly a Posting Virtuoso
coop123 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.