System.ArgumentException: The table type parameter must have a valid type name

后端 未结 3 539
南方客
南方客 2021-01-01 09:28

I am trying to pass in a user defined table type into a query in C#.

the type is defined with 2 columns (org and sub org)

this is what my code looks like:

3条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-01 10:03

    Note that this may also happen when you're executing a stored procedure and you don't have the SqlCommand.CommandType set to CommandType.StoredProcedure, as such:

    using (SqlCommand cmd = new SqlCommand("StoredProcName", conn))
    {
        cmd.CommandType = CommandType.StoredProcedure;
        cmd.ExecuteNonQuery();
    }
    

提交回复
热议问题