Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
ADO Error. Invalid Object Name
Message
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Divers
Thread ID:
01437967
Message ID:
01438083
Vues:
34
ADO.Net

FWIW, see my response to Nadia


>I gotta ask.. is it an ADO or ADO.NET error?
>
>>I have a SQL stored proc called wit_AddAddress:
>>
>>
>>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
>>
>>
>>I have verified that this proc is there in SQL. When I run the following C# code, I get the error "Invalid object name 'wit_AddAddress'":
>>
>>
>>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;
>>}
>>
>>
>>When called for edits, the reference to "wit_UpdateAddress" works. Like I said, the proc is there. Anyone know why this would be happening????
Everything makes sense in someone's mind
public class SystemCrasher :ICrashable
In addition, an integer field is not for irrational people
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform