If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > Problem recognizing variable

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-11-04, 09:11
cusoxty cusoxty is offline
Registered User
 
Join Date: Jun 2004
Posts: 25
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
Reply With Quote
  #2 (permalink)  
Old 06-11-04, 11:05
Seppuku Seppuku is offline
Useless...
 
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.
Reply With Quote
  #3 (permalink)  
Old 06-11-04, 11:08
Seppuku Seppuku is offline
Useless...
 
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.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On