Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2004
    Posts
    25

    Unanswered: Problem recognizing variable

    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

  2. #2
    Join Date
    Jul 2003
    Location
    SoCal
    Posts
    721
    That's VBScript, not ASP. There is no "AS" keyword when dimensioning variables in ASP.

    Ex:
    ------------------
    Dim conn, cmd
    Set conn = Server.CreateObject("ADODB.Connection")
    Set cmd = Server.CreateObject("ADODB.Command")
    ------------------

    Secondly, in ASP you have to create Parameter objects and connect them to the Command object.
    That which does not kill me postpones the inevitable.

  3. #3
    Join Date
    Jul 2003
    Location
    SoCal
    Posts
    721
    You posted this same question yesterday....

    http://www.dbforums.com/t1001013.html

    It helps to not duplicate your post in the same forum...
    That which does not kill me postpones the inevitable.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •