Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old September 12th, 2012, 08:35 PM
xpasaway xpasaway is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2012
Posts: 5 xpasaway User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 20 m 16 sec
Reputation Power: 0
Procedure or function expects parameter

Hi, need help.
i have a program, where i was not unable to update anything from selected data, because this error appears " Procedure or function 'SP_Assigned_Vehicle_Update' expects parameter '@Pilot_ID', which was not supplied."


Here is my code in sql 2008 stored procedured "SP_Assigned_Vehicle_Update"

USE [PILOT_SCHEDULE]
GO
/****** Object: StoredProcedure [dbo].[SP_Assigned_Vehicle_Update] Script Date: 09/13/2012 09:02:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[SP_Assigned_Vehicle_Update]

@Assign_Vehicle_ID int output,
@Pilot_ID bigint,
@Schedule_No int,
@Plate_No nvarchar(10),
@Description nvarchar(150),
@Transaction_Date smalldatetime,
@Destination nvarchar(50),
@Departure_Time smalldatetime,
@Arrival_Time smalldatetime,
@Cancel bit,
@Cancel_By nvarchar(50)

AS
begin

SET @Transaction_Date = GETDATE() -- To set ModifiedDate from datetime

UPDATE Assigned_Vehicle

SET

Pilot_ID=@Pilot_ID,
Schedule_No = @Schedule_No,
Plate_No = @Plate_No,
Description = @Description,
Transaction_Date = @Transaction_Date,
Destination = @Destination,
Departure_Time = @Departure_Time,
Arrival_Time = @Arrival_Time,
Cancel = @Cancel,
Cancel_By = @Cancel_By

WHERE Assign_Vehicle_ID = @Assign_Vehicle_ID

--SELECT * FROM Assigned_Vehicle --For Check if the added

END




and here is my code under visual basic 2010

Private Sub assigned_vehicle_update()
Dim cmd As SqlClient.SqlCommand
Try
cmd = New SqlClient.SqlCommand
With cmd
.Connection = Globals.Connection
.CommandType = CommandType.StoredProcedure
.CommandText = "SP_Assigned_Vehicle_Update"
'from database itself
.Parameters.Add("@Assign_Vehicle_ID", SqlDbType.Int)
.Parameters.Add("@Pilot_ID", SqlDbType.BigInt)
.Parameters.Add("@Schedule_No", SqlDbType.Int)
.Parameters.Add("@Plate_No", SqlDbType.NVarChar, 10)
.Parameters.Add("@Description", SqlDbType.NVarChar, 50)
.Parameters.Add("@Transaction_Date", SqlDbType.SmallDateTime)
.Parameters.Add("@Destination", SqlDbType.NVarChar, 150)
.Parameters.Add("@Departure_Time", SqlDbType.SmallDateTime)
.Parameters.Add("@Arrival_Time", SqlDbType.SmallDateTime)
.Parameters.Add("@Cancel", SqlDbType.Bit)
.Parameters.Add("@Cancel_By", SqlDbType.NVarChar, 50)
'for windows gui
.Parameters("@Assign_Vehicle_ID").Value = Assign_Vehicle_ID
.Parameters("@Pilot_ID").Value = Me.cboPilotName.SelectedValue
.Parameters("@Schedule_No").Value = Me.cboScheduleNo.SelectedValue
.Parameters("@Plate_No").Value = Me.cboPlateNo.SelectedValue
.Parameters("@Description").Value = Me.cboDescription.SelectedValue
.Parameters("@Transaction_Date").Value = Me.dtpTransactionDate.Value.ToShortDateString
.Parameters("@Destination").Value = Me.cboDestination.Text.Trim
.Parameters("@Departure_Time").Value = Me.dtpDepartureTime.Value.ToShortTimeString
.Parameters("@Arrival_Time").Value = Me.dtpArrivalTime.Value.ToShortTimeString
.Parameters("@Cancel").Value = Me.chkCancel.Checked
.Parameters("@Cancel_By").Value = Me.txtCancelBy.Text.Trim

.ExecuteNonQuery()

End With

Catch ex As Exception
'Throw ex
MsgBox(ex.Message)
End Try
End Sub


I hope u can help me guys regarding this error. Thank you very much.
Highly appreciated if u can help me with this one..

thanks.

Reply With Quote
  #2  
Old September 13th, 2012, 06:47 PM
AndrewSW's Avatar
AndrewSW AndrewSW is offline
JavaScript is not spelt java
Dev Shed Novice (500 - 999 posts)
 
Join Date: Feb 2011
Location: Landan, England
Posts: 743 AndrewSW User rank is First Lieutenant (10000 - 20000 Reputation Level)AndrewSW User rank is First Lieutenant (10000 - 20000 Reputation Level)AndrewSW User rank is First Lieutenant (10000 - 20000 Reputation Level)AndrewSW User rank is First Lieutenant (10000 - 20000 Reputation Level)AndrewSW User rank is First Lieutenant (10000 - 20000 Reputation Level)AndrewSW User rank is First Lieutenant (10000 - 20000 Reputation Level)AndrewSW User rank is First Lieutenant (10000 - 20000 Reputation Level)AndrewSW User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 2 Weeks 1 Day 23 h 1 m 13 sec
Reputation Power: 164
I would check that Me.cboPilotName.SelectedValue returns something , and that this something is an integer.

You may also need to explicitly cast SelectedValue to an integer.
Comments on this post
medialint agrees!

Last edited by AndrewSW : September 13th, 2012 at 06:50 PM.

Reply With Quote
  #3  
Old September 13th, 2012, 10:47 PM
xpasaway xpasaway is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2012
Posts: 5 xpasaway User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 20 m 16 sec
Reputation Power: 0
thanks buddy, i have already the solutions, and i want to share:
here is the solution i made.

in my sql database, i called a view, and one of my codes i have concatenation and here is the code
SELECT Pilot_ID, Emp_No, Pilot_Name, Include, Pilot_Name + ' ' + Emp_No AS Pilot_Names
FROM dbo.Pilot
WHERE (Include = 1)

take note of this " Pilot_Name + ' ' + Emp_No AS Pilot_Names" i added it on my vw_Pilot (under sql 2008, database view)
and thats it, my problems gone.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming > Procedure or function expects parameter

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap