Search code examples
c#.netsqloledb

Why am I getting OleDBException "No value given for one or more required parameters?"


This is my code:

command.CommandText = 
   "SELECT DISTINCT B.* FROM BlankFormSubmissions B, Actions A WHERE B.FormName = " + 
   GenericRoutines.SqlFmt(form.Name) + 
   " AND B.ProcessName = A.ProcessName AND B.ActionName = A.ActionName" +
   " ORDER BY B.ID";

OleDbDataReader reader = command.ExecuteReader();

The SQL is:

SELECT DISTINCT B.* 
FROM BlankFormSubmissions B, Actions A 
WHERE B.FormName = 'FindingNemo' 
  AND B.ProcessName = A.ProcessName 
  AND B.ActionName = A.ActionName 
ORDER BY B.ID

Solution

  • I found by running the SQL within Access, that I was actually just referencing a column (FormName) which did not exist in the Access table.