Error when adding a query to an SqlCE database RRS feed

  • Question

  • Hello everybody,

    I've got the same problem as in this link. And I know how to solve it. But the problem is created by VS2008 itself.

    In some cases VS2008 creates it like:

    global::System.Data.SqlServerCe.SqlCeParameter param = new global::System.Data.SqlServerCe.SqlCeParameter();
    and then the rest can continue. But in some cases (and why it is I would like to find out here) is creates it like:
    new global::System.Data.SqlServerCe.SqlCeParameter("@vakgroepID", global::System.Data.SqlDbType.BigInt, 8, global::System.Data.ParameterDirection.Input, true, 0, 0, "Vakgroep_ID", global::System.Data.DataRowVersion.Current, null) = new global::System.Data.SqlServerCe.SqlCeParameter();
    So why is this. Is this a bug in VS2008 or is something wrong in the query
    my query looks like
    SELECT     COUNT(*)
    FROM         Table1
    WHERE     (Param2 = @pParm2) AND (Param3 = @pParam3) AND EXISTS
                              (SELECT     ''
                                FROM          Table2
                                WHERE      (Table1.Param1 = Param1) AND (Param4 = @pParam4))
    Hope someone can help
    Kind regards
    EDIT: When I change the creation to use Param it builds but when I run it it gives the following error:
    Parameter type has not been declared. [ Parameter ordinal = 2,Parameter name (if available) = @pParam4 ]
    • Edited by jkorsten Thursday, October 14, 2010 8:50 AM Got another error
    Thursday, October 14, 2010 8:11 AM