Invalid Use of Default Parameter

If you get this message:

 ERROR [07S01] [Microsoft][ODBC SQL Server Driver]Invalid use of default parameter

It means you tried to insert a row with a null value in a column that doesn’t allow nulls.  Bad message.

 

One Response to “Invalid Use of Default Parameter”

  1. Jeremy Says:

    Note that if you’re using an ADO Command object and parameterising a query in VBScript ASP Classic, you’ll get this message if you’re passing the wrong type of null value to a column that DOES allow nulls. By default, if you leave the value of a parameter unset, it’ll be set to the special value DBNull, which is defined in VBScript; contrary to other types of .NET programming, you have to use the regular VBScript null value:

    if (Request.form(“email”) “”) then
    .parameters(“Email”).value = Request.form(“email”)
    else
    .parameters(“Email”).value = null
    end if

    If you didn’t have the “else” there, the value would default to DBNull and fail with the above error.

Leave a Reply

Powered by WP Hashcash