Just like my last post I cannot solve this problem with a stored procedure in MSSQL Server 2000 Developer Edition.
I am trying to use the parameter in VB.NET 2003.
When I run the VB code and execute the stored procedure, the exact error message is: "Parameter1 is not a parameter for procedure EditCustomer."
The only thing is it is a parameter for the procedure. I would appreciate any help with this one. Most probably an obvious, simple mistake which I can't see.
Here is the code for the stored procedure.
Also, here is the VB code which calls the stored procedure.
From what I can see it should work right there, but it doesn't :(.
On another note, I have a similar stored procedure only not for a customer. It works nearly perfectly, but it's only saving the first character of each string I pass to it. The parameters types are of 'nvarchar', and the I've tried using the DbTypes of 'AnsiString' and 'String'.
It's like the string gets trimmed when the data is passed into the stored procedure, or when the stored procedure saves the data into the table.
Any advice on this one?
Thank you.
I am trying to use the parameter in VB.NET 2003.
When I run the VB code and execute the stored procedure, the exact error message is: "Parameter1 is not a parameter for procedure EditCustomer."
The only thing is it is a parameter for the procedure. I would appreciate any help with this one. Most probably an obvious, simple mistake which I can't see.
Here is the code for the stored procedure.
Code:
CREATE PROCEDURE EditCustomer ( @ID int, @FullName nvarchar, @Street nvarchar, @Suburb nvarchar, @Postcode int, @State nvarchar, @Fines money, @Phone int, @JoinDate datetime ) AS UPDATE Customers SET Full_Name=@FullName, Street=@Street, Suburb=@Suburb, Postcode=@Postcode, State=@State, Fines_Oweing=@Fines, Phone=@Phone, Join_Date=@JoinDate WHERE Member_ID=@ID GO
Code:
Dim cmdEditCustomer As New SqlCommand cmdEditCustomer.CommandType = CommandType.StoredProcedure cmdEditCustomer.CommandText = "EditCustomer" cmdEditCustomer.Connection = sqlConn Dim paramID As New SqlParameter paramID.DbType = DbType.Int32 paramID.Direction = ParameterDirection.Input paramID.ParameterName = "@ID" paramID.Value = intID Dim paramFullName As New SqlParameter paramFullName.DbType = DbType.AnsiString paramFullName.Direction = ParameterDirection.Input paramFullName.ParameterName = "@FullName" paramFullName.Value = strFullName ' Also same sort of code for 7 other parameters you can see in stored procedure ' This function is also called for 7 other parameters cmdEditCustomer.Parameters.Add(paramID) cmdEditCustomer.Parameters.Add(paramFullName) sqlConn.Open() cmdEditCustomer.ExecuteNonQuery() sqlConn.Close()
On another note, I have a similar stored procedure only not for a customer. It works nearly perfectly, but it's only saving the first character of each string I pass to it. The parameters types are of 'nvarchar', and the I've tried using the DbTypes of 'AnsiString' and 'String'.
It's like the string gets trimmed when the data is passed into the stored procedure, or when the stored procedure saves the data into the table.
Any advice on this one?
Thank you.
Comment