I am having trouble figuring out what the problem is on my page. I have a stored procedure that enters specific data into a table. On my webpage, the user selects the name of a territory, and the TerritoryID, DivisionID, RegionID, and EmpID associated with that territory are to be entered. However, my page keeps giving me the error message "Procedure 'InsertAllThree' expects parameter '@FromName', which was not supplied." How would i go about fixing this?
HERE IS MY ASP
Code:
Sub InsertData()
Dim sql as string
dim sql1 = "insertallthree '" & AccNumber.SelectedItem.Value & "'" & "'" &
FromName.SelectedItem.Value & "'"
' Create Connection Object, Command Object, Connect to the database
Dim conn as New SQLConnection(connstr)
Dim cmd1 as New SQLCommand(sql1,conn)
conn.open()
cmd1.ExecuteNonQuery()
conn.Close()
'go to the datagrid query page
Response.redirect(return_page)
end sub
----------------------------------------------
AND HERE IS MY STORED PROCEDURE:
CREATE PROCEDURE InsertAllThree
@AccountID char(10),
@FromName nvarchar(50)
AS
insert into accounttransferstestmike
(AccountID, FromTerritoryID, FromRegionID, FromDivisionID, FromEmpID)
select Accounts.AccountID, Territories.TerritoryID, Regions.RegionID, Divisions.DivisionID, Employees.EmployeeID
From Accounts, Territories, Regions, Divisions, Employees
Where (Accounts.AccountID = @AccountID) and (EndoscopySqlUser.Employees.DateLeft IS NULL) AND (EndoscopySqlUser.Territories.TerritoryName=@FromN ame)
GO