USE WorkIT declare @p1 bigint set @p1=NULL exec wit_AddAddress @AddressKey=@p1 output,@AddressTypeKey=456,@Street1=N'AAAAAAAAAAAAAA',@Street2=N'AAAAAAAAAAAAAAA',@City=N'AAAAAAAAAAAA',@State=N'AA',@PostalCode=N'AAAAA' select @p1I get the same error. Yet the sproc IS in the database.
>>CREATE PROCEDURE wit_AddAddress >> @AddressTypeKey INT, >> @Street1 VARCHAR(100), >> @Street2 VARCHAR(100), >> @City VARCHAR(40), >> @State CHAR(2), >> @PostalCode CHAR(10), >> @AddressKey INT = 0 OUTPUT >>AS >> >>BEGIN >> >> INSERT INTO wit_AddAddress >> (AddressTypeKey, Street1, Street2, City, State, PostalCode) >> VALUES >> (@AddressTypeKey, @Street1, @Street2, @City, @State, @PostalCode) >> >> SET @AddressKey = SCOPE_IDENTITY() >> >>END >>>>
>>public override bool SaveChanges() >>{ >> bool RetVal = Validate(); >> >> if (RetVal) >> { >> string ProcName = string.Empty; >> >> SqlParameter pAddressKey = new SqlParameter("@AddressKey", 0); >> >> if (this.RecordId == 0) >> { >> pAddressKey.Direction = ParameterDirection.Output; >> ProcName = "wit_AddAddress"; >> } >> else >> { >> >> pAddressKey.Value = this.RecordId; >> ProcName = "wit_UpdateAddress"; >> } >> >> SqlParameter pAddressTypeKey = new SqlParameter("@AddressTypeKey",_AddressTypeKey); >> SqlParameter pStreet1 = new SqlParameter("@Street1", _Street1); >> SqlParameter pStreet2 = new SqlParameter("@Street2", _Street2); >> SqlParameter pCity = new SqlParameter("@City", _City); >> SqlParameter pState = new SqlParameter("@State", _State); >> SqlParameter pPostalCode = new SqlParameter("@PostalCode", _PostalCode); >> >> ArrayList colParams = new ArrayList(); >> colParams.Add(pAddressKey); >> colParams.Add(pAddressTypeKey); >> colParams.Add(pStreet1); >> colParams.Add(pStreet2); >> colParams.Add(pCity); >> colParams.Add(pState); >> colParams.Add(pPostalCode); >> >> AppDataAccess.ExecuteNonQuery(ProcName, colParams); >> >> if (AppDataAccess.DataException == null) >> { >> >> if (pAddressKey.Direction == ParameterDirection.Output) >> { >> this.RecordId = Convert.ToInt32(pAddressKey.Value); >> } >> } >> else >> { >> throw AppDataAccess.DataException; >> } >> } >> >> return RetVal; >>} >>>>