Welcome to the dBforums forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions, articles and access our other FREE features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload your own photos and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact support.

If you prefer not to see double-underlined words and corresponding ads, place your cursor
here for ContentLink opt out.

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, 10: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, 12: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, 12: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

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