Hey Guys, here is my code for this, the only help i get from VS is that the INSERT INTO statement syntax is incorrect?
I have gone through all of the code and just cannot see where i have gone wrong, can someone gimme a hand please?
public void New(string ApplicationStartupPath, string FileName, string Department, string Month, string Year)
{
string sql = "INSERT INTO PodcastsDir (FileName, Department, Month, Year) VALUES (@FileName, @Department, @Month, @Year)";
using (OleDbConnection conn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" + ApplicationStartupPath.ToString() + ""))
using (OleDbCommand cmd = new OleDbCommand(sql, conn))
{
cmd.Parameters.Add("@FileName", OleDbType.VarChar);
cmd.Parameters.Add("@Department", OleDbType.VarChar);
cmd.Parameters.Add("@Month", OleDbType.VarChar);
cmd.Parameters.Add("@Year", OleDbType.VarChar);
conn.Open();
cmd.Parameters[0].Value = FileName;
cmd.Parameters[1].Value = Department;
cmd.Parameters[2].Value = Month;
cmd.Parameters[3].Value = Year;
cmd.ExecuteNonQuery();
}
}
Thanks Ash