Procedure or function 'selectFromView' expects parameter '@Year', which was not supplied. ???

 hay all, i'm trying to pass parameters to a stored procedure ..and i keep getting this error

"Procedure or function 'selectFromView' expects parameter '@Year', which was not supplied."

 this is the procedure implementation :

 

ALTER PROCEDURE dbo.selectFromView 
		
	@Year as varchar(10),
        @Country as varchar(10),
        @Family as varchar(10),
        @Manu as varchar(10),
        @Status as varchar(10),
        @Type as varchar(10),
        @Operator as varchar(10)
	
	
AS
	SELECT * FROM ViewofAll
	WHERE
	ProductionYear = @Year and
	CountryName = @Country and
	Family = @Family and
	Manufacturer = @Manu and
	Status = @Status and
	Type = @Type and
	OperatorName = @Operator
	
	RETURN
 
and below how i call the procedure : 
 
        Dim connection As SqlConnection
        connection = New SqlConnection()
        connection.ConnectionString = "Data Source=BLACKIRIS3\SQLEXPRESS;Initial Catalog=Aircrafts;Integrated Security=True"
        connection.Open()
        Dim command As SqlCommand
        command = New SqlCommand("selectFromView", connection)
        command.CommandType = CommandType.StoredProcedure      
        command.Parameters.Add(New SqlParameter("@Year", System.Data.SqlDbType.VarChar, 100)).Direction = ParameterDirection.Input
        command.Parameters.Add(New SqlParameter("@Country", System.Data.SqlDbType.VarChar, 100)).Direction = ParameterDirection.Input
        command.Parameters.Add(New SqlParameter("@Family", System.Data.SqlDbType.VarChar, 100)).Direction = ParameterDirection.Input
        command.Parameters.Add(New SqlParameter("@Manu", System.Data.SqlDbType.VarChar, 100)).Direction = ParameterDirection.Input 'Stored prcedure parameters
        command.Parameters.Add(New SqlParameter("@Status", System.Data.SqlDbType.VarChar, 100)).Direction = ParameterDirection.Input
        command.Parameters.Add(New SqlParameter("@Type", System.Data.SqlDbType.VarChar, 100)).Direction = ParameterDirection.Input
        command.Parameters.Add(New SqlParameter("@Operator", System.Data.SqlDbType.VarChar, 100)).Direction = ParameterDirection.Input
        command.Parameters.Item("@Year").Value = myArray(0)
        command.Parameters.Item("@Country").Value = myArray(1)
        command.Parameters.Item("@Family").Value = myArray(2)
        command.Parameters.Item("@Manu").Value = myArray(3)
        command.Parameters.Item("@Status").Value = myArray(4)
        command.Parameters.Item("@Type").Value = myArray(5)
        command.Parameters.Item("@Operator").Value = myArray(5)    
        DSGrid.SelectCommand = command.CommandText
        With DSGrid
            .DataBind()
        End With
 
i'm not really familiar with stored procedures ...any one can help me plz ?

 

thanx in advance . 

 


GLORY
~Please mark as answer if this helps u~
0
majd_wadi
5/21/2008 3:31:38 PM
asp.net.sql-datasource 29906 articles. 0 followers. Follow

3 Replies
665 Views

Similar Articles

[PageSpeed] 27

I think think the "command" automatically appends the "@" by default. Try removing it from your parameter names.

0
valenumr
5/21/2008 3:57:17 PM

majd_wadi:
command = New SqlCommand("selectFromView", connection) command.CommandType = CommandType.StoredProcedure command.Parameters.Add(New SqlParameter("@Year", System.Data.SqlDbType.VarChar, 100)).Direction = ParameterDirection.Input command.Parameters.Add(New SqlParameter("@Country", System.Data.SqlDbType.VarChar, 100)).Direction = ParameterDirection.Input command.Parameters.Add(New SqlParameter("@Family", System.Data.SqlDbType.VarChar, 100)).Direction = ParameterDirection.Input command.Parameters.Add(New SqlParameter("@Manu", System.Data.SqlDbType.VarChar, 100)).Direction = ParameterDirection.Input 'Stored prcedure parameters command.Parameters.Add(New SqlParameter("@Status", System.Data.SqlDbType.VarChar, 100)).Direction = ParameterDirection.Input command.Parameters.Add(New SqlParameter("@Type", System.Data.SqlDbType.VarChar, 100)).Direction = ParameterDirection.Input command.Parameters.Add(New SqlParameter("@Operator", System.Data.SqlDbType.VarChar, 100)).Direction = ParameterDirection.Input command.Parameters.Item("@Year").Value = myArray(0) command.Parameters.Item("@Country").Value = myArray(1) command.Parameters.Item("@Family").Value = myArray(2) command.Parameters.Item("@Manu").Value = myArray(3) command.Parameters.Item("@Status").Value = myArray(4) command.Parameters.Item("@Type").Value = myArray(5) command.Parameters.Item("@Operator").Value = myArray(5)
  

Imports System.Data
Imports System.Data.SqlClient

command = new SqlCommand("exec selectFromView @Year, @Country, @Family, @Manu, @Status, @Type, @Operator", conn)

Dim params(7) as SqlParameter

params(0) = new SqlParameter("@Year", SqlDbType.VarChar)
params(0).Value = myArray(0)

params(1) = new SqlParameter("@Country",SqlDbType.VarChar)
params(1).Value = myArray(1)

params(2) = new SqlParameter("@Family",SqlDbType.VarChar)
params(2).Value = myArray(2)

params(3) = new SqlParameter("@Manu", SqlDbType.VarChar)
params(3).Value = myArray(3)

params(4) = new SqlParameter("@Status",SqlDbType.VarChar)
params(4).Value = myArray(4)

params(5) = new SqlParameter("@Type",SqlDbType.VarChar)
params(5).Value = myArray(5)

params(6) = new SqlParameter("@Operator",SqlDbType.VarChar)
params(6).Value = myArray(6)

Dim reader As SqlDataReader
reader = command.ExecuteReader()

gridView1.DataSource = reader
gridView1.DataBind()
 

 


Dev
0
devcalpoly
5/22/2008 1:16:14 AM

Try this

   Dim sConnection As String = ConfigurationManager.ConnectionStrings("AirCraftsConnectionString").ConnectionString
 'connection string "Data Source=BLACKIRIS3\SQLEXPRESS;Initial Catalog=Aircrafts;Integrated Security=True" is stored in web.config
as AirCraftsConnectionString


        Dim sCommand As String = "selectFromView"


        Dim oDt As DataTable = Nothing
        Dim oDA as SqlDataAdapter = new SqlDataAdapter()

        Using oCn As New SqlConnection(sConnection)
            Using oCmd As SqlCommand = New SqlCommand(sCommand, oCn)


                oCmd.CommandType = CommandType.StoredProcedure

                oCmd.Parameters.AddWithValue("@Year", myArray(0))
                oCmd.Parameters.AddWithValue("@Country", myArray(1))
                oCmd.Parameters.AddWithValue("@Family", myArray(2))
                oCmd.Parameters.AddWithValue("@Manu", myArray(3))
                oCmd.Parameters.AddWithValue("@Status", myArray(4))
                oCmd.Parameters.AddWithValue("@Type", myArray(5))
                oCmd.Parameters.AddWithValue("@Operator", myArray(6))
               
                If oCn.State <> ConnectionState.Open Then
                    oCn.Open()
                End If

                If oCn.State = ConnectionState.Open Then

      oDA.SelectCommand = oCmd
      DataSet oDS = new DataSet()
             oDA.Fill(oDS, "flightdetails")


  End If

            End Using
        End Using


       If (oDS.Tables.Count > 0) Then

          DSGrid.DataSource = oDS
         DSGrid.DataBind()


        Else

          'Raise some error here
        End If


Regards, Sreenivas (Vasu) Chaparala
ps:Unless a question, this is an attempt to provide guidance. Turning this into a solution, if required, is ones own responsibility. Expecting the entire solution as-is is inappropriate for any professional.
0
vasuvani
5/22/2008 3:13:11 AM
Reply:

Similar Artilces:

''''''''''''''''''''
Name: haznen Email: haznenatyahoodotcom Product: Gran Paradiso Alpha 8 Summary: '''''''''''''''''''' Comments: '''''''''''''''''''''''''''''''''''' Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a1) Gecko/20061204 UGES/1.7.2.0 GranParadiso/3.0a1 From URL: http://www.mozilla.org/projects/granparadiso/ Note to readers: Hendrix gives...

Procedure or Function 'SubscribeToNewsletters' expects parameter '@emailAddress', which was not supplied.
Hi i have been trying to insert some values selected in a checkbox list into the database, however it is giving me the following error "Procedure or Function 'SubscribeToNewsletters' expects parameter '@emailAddress', which was not supplied. "public void Page_Load(object sender, EventArgs e) -- on page load the checkbox list is populated through stored procedure (stream_NewsletterTypes) { try {SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["streamConnectionString"].ConnectionString); SqlCommand command = new SqlCommand(...

Procedure or Function 'retrieve_product' expects parameter '@productPrice', which was not supplied.
Hi i am getting this error whenever i try to execute a stored procedure, below is my stored procedure;  ALTER PROCEDURE [dbo].[retrieve_product] -- Add the parameters for the stored procedure here @productPrice decimal (10,2), @productInfoURL varchar (255), @categoryName varchar (255),@companyName varchar (255), @subCategoryName varchar (255), @companyWebsiteURL varchar (255) AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT statements. SET NOCOUNT ON; -- Insert statements for procedure here SELECT Categories.categoryName, SubC...

Procedure or Function 'syl_EmailQueueInsert' expects parameter '@EmailCC', which was not supplied.
We have a email table in the database (SQL Server 2005). When we try to execute the Insert Stored Proc in the database to add a record and leave the EmailCC and EmailBCC fields blank we are getting the following error: Msg 201, Level 16, State 4, Procedure syl_EmailQueueInsert, Line 0Procedure or Function 'syl_EmailQueueInsert' expects parameter '@EmailCC', which was not supplied. The EmailCC and EmailBCC are set to allow nulls. Shouldn’t the system automatically insert nulls into those colums if no value is supplied??? What am I doing wrong? Newbie I a...

Procedure or Function 'UpdateContactInfoProc' expects parameter '@SUBURB', which was not supplied.
I tried to use this update stored procedure from a objectdatasource which calls the method "UpdateCompanyInfo", however, once I leave an item to be empty I got the error as title.My stored procedure:ALTER PROCEDURE dbo.UpdateContactInfoProc@Contact_ID int,@Contact_Type_ID int,@Name nvarchar(100),@TEL nvarchar(50),@EMAIL nvarchar(50),@ADDRESS nvarchar(200),@SUBURB nvarchar(50),@FAX nvarchar(50),@STATE nvarchar(50),@POSTCODE nvarchar(50),@COUNTRY nvarchar(50),@Description textASUpdate Contactset Contact_Type_ID = @Contact_Type_ID, [Name] = @Name, TEL = @TEL, EMAIL = @EMAIL, ADDRESS=@...

'''''
Name: mario Email: ramar17atfastwebnetdotit Product: Gran Paradiso Alpha 2 Summary: ''''' Comments: K: Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a2) Gecko/20070206 GranParadiso/3.0a2 ...

Procedure 'Create_User' expects parameter '@Password', which was not supplied.
Hi AllGetting Procedure 'Create_User' expects parameter '@Password', which was not supplied errorI can't register new user in role based system app, the following code is from register.aspx: private void Submit_Click(object sender, System.EventArgs e) { User user; if (Context.User.Identity.IsAuthenticated) user = new User(((SiteIdentity)User.Identity).UserID); else user = new User(); user.FullName = FullName.Text; user.Email = Email.Text; user.Password = Password.Text; user.Biography = Biography.Text; if (Context.User.Identity.IsAuthenticated) { user.Update(); Response.Redirec...

Procedure 'JaiDeleteUser' expects parameter '@user_name', which was not supplied
<html xmlns="http://www.w3.org/1999/xhtml"> <head id="Head1" runat="server"><title>Untitled Page</title> </head> <body>   <form id="form1" runat="server"> <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager>   <div>   <br /> <asp:Label ID="lblUserInfo" runat="server" Text="Label"></asp:Label><asp:SqlDataSource ID="SqlDataSource1" runat="server"...

Procedure 'x' expects parameter '@y' which was not supplied.
I'm trying to update a member's record via stored procedure. The procedure is thus: ********************************* CREATE PROCEDURE upd_MemberProfile( @MemberID VarChar(10), @FirstName VarChar(20), @LastName VarChar(20), @Address VarChar(50), @City VarChar(40), @StateID Char(2), @ZipCode Char(5), @Email VarChar(30), @PayPalSubscrID VarChar(22) ) AS UPDATE Members SET FirstName = @FirstName, LastName = @LastName, Address = @Address, City = @City, StateID = @StateID, ZipCode = @ZipCode, Email = @Email, PayPalSubscrID = @PayPalSubscrID WHERE Me...

Procedure 'CRMC_ProductDetails' expects parameter '@Color', which was not supplied
I keep getting this error when I browse the productsdetail.aspx page... I am using the C# SDK version of the Commerce kit... I have added a new col in th eDB called "Color", and *thought* that I had fixed the strored proc, and the product.cs file... I can get the color from the db to display on the productslist.aspx page fine... Any ideas? Did you modify the ProductDetails GetProductDetails function in productsdb.cs?...

Procedure 'sp03_Delete_Usuario' expects parameter '@AN001_CDUSUARIO', which was not supplied.
I´m having problem to delete/update using stored procedure with gridview. Actually I made an update and delete work but just by itself not togheter. I made update ONLY works If I dont pass any fields from gridview to datakeynames and the delete show the following error: Procedure 'sp03_Delete_Usuario' expects parameter '@AN001_CDUSUARIO', which was not supplied. But the delete ONLY works if I pass all the fields form gridview to datakeynames. So the update stops to work. The code is:<%@ Page Language="VB" AutoEventWireup="false" CodeF...

Procedure 'sp_GetEEByDept' expects parameter '@tkdept', which was not supplied.
I have a basic vb.net form with a few text fields and dropdown boxes.  In one of the dropdown boxes, I ask the user to select a department.  After the user selects the department, I want to fill another dropdown box with employees that belong to the selected dept.  I keep getting an error for my procedure that is to get the employees, because I can't figure out how to pass in the department selected in the first drop down box.  ARGH... Also, do I need to set the employee dropdown box visible to false until the first dropdown selection is made, otherwise, it'd be b...

Error--Procedure 'SP_Insert_NewPipeLine' expects parameter '@CompanyId', which was not supplied.
Can any body help me in solving this problem. First I use to get Error which reads "Object Must Implement Iconvertible" After using the overloaded Sp.paramerers.add() function It started giving this problem. I am giving the sample code. ConObject = new SqlConnection(ConString); ConObject.Open(); string SpString ="dbo.SP_Insert_NewPipeLine"; SqlCommand CmdObject = new SqlCommand(SpString,ConObject); CmdObject.CommandType = CommandType.StoredProcedure; CmdObject.Parameters.Add("@RequestTypeId",SqlDbType.Int,4,"0"); //CmdObject.Parameters["@RequestTypeId"].Value= 0; CmdObject.Parame...

SQL_Error Procedure 'DelectHostName' expects parameter '@Host', which was not supplied.
How do I supply the parameter @Host?  Below is the part of my code that has the call to the stored procedure  public void DeleteHostName() { // start of the method using (SqlConnection cn = new SqlConnection(ConfigurationManager.AppSettings["ConnectionString"]))            {                 cn.Open();                SqlCommand cmd = new SqlCommand("hnDeleteHost&...

Web resources about - Procedure or function 'selectFromView' expects parameter '@Year', which was not supplied. ??? - asp.net.sql-datasource

Resources last updated: 1/18/2016 3:26:37 AM