Hello,
I hope this is the right forum for my question.
I am using VB in an ASP.NET application connecting to an MS Access db (Access 2010) using a stored parametrized query
I want to be able to assign NULL to one of the parameter so that the query will return all the rows (kind of like using a wildcard, except that is how it works with Access)
I use the following code in a Private Function:

Dim constring As String = ConfigurationManager.ConnectionStrings("dbPN_ConnectionString").ConnectionString
Using con As OleDbConnection = New OleDbConnection(constring)
Using cmd As OleDbCommand = New OleDbCommand(strQuery, con)
cmd.CommandType = Data.CommandType.StoredProcedure
cmd.Parameters.AddWithValue("Project", sProject)
cmd.Parameters.AddWithValue("Category", sCat)
If sSubcat = "" Then
cmd.Parameters.Add(DBNull.Value)
Else
cmd.Parameters.AddWithValue("SubCategory", sSubcat)
End If
con.Open()

When I try to run this, I get the following error message: the Oledbparametercollection only accepts non null oledbparameter type objects, not string objects

Obviously I am not using the correct approach but with an Access db, I am not sure what other path I could follow.
Any help/insight would be appreciated
Thanks
Olivier