The above code is giving me the syntax error for insert statement. What is wrong in my code? I am not figuring out the actual cause of the error message.Code:void add(int accnum,string username, string password, string m, string fn, string ln, string college) { OleDbConnectionStringBuilder ocsb; OleDbConnection conn; OleDbCommand myCmd; OleDbDataReader reader; OleDbParameter p, q; conn.Open(); string iSQL = "INSERT INTO AccountData(username, passwrd, email, firstName, lastName, college) VALUES(username, password, m, fn, ln, college)"; myCmd = new OleDbCommand(iSQL, conn); myCmd.Parameters.Add("username", OleDbType.VarChar).Value = username; myCmd.Parameters.Add("password", OleDbType.VarChar).Value = password; myCmd.Parameters.Add("m", OleDbType.VarChar).Value = m; myCmd.Parameters.Add("fn", OleDbType.VarChar).Value = fn; myCmd.Parameters.Add("ln", OleDbType.VarChar).Value = ln; myCmd.Parameters.Add("college", OleDbType.VarChar).Value = college; myCmd.ExecuteNonQuery(); conn.Close(); }
Bookmarks