Hello All ...
Iam Getting An Error With try to excecute the stored procedure .
I have Have Sql database , the stored procedure like so :
USE [MPRS]
GO
/****** Object: StoredProcedure [dbo].[Search_Licenses_By_Number] Script Date: 26-Nov-16 8:06:52 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[Search_Licenses_By_Number]
@LicenseNumber int
as
begin
Select LicenseNumber,CentralRegistryNumber, LicenseNameArabic, LicenseNameEnglish, LegalForm, ExpiryDate, LicenseOwner, LicenseOwnerNationality, LicenseType, LicenseActivities, LicenseAddress, Phone, Fax, Email, LicenseStatus from LicensesTbl
Where LicenseNumber = @LicenseNumber
End
In Vb i have Data Layer and code like so :
Friend Function Search_Licenses_By_Number(ByRef cmd As SqlCommand, ByRef dr As SqlDataReader, ByVal LicenseNumber As Integer)
Dim retval As Integer
cmd = New SqlCommand("Search_Licenses_By_Number")
cmd.Parameters.Add("@LicenseNumber", LicenseNumber, SqlDbType.Int)
cmd.Parameters.Add("@CentralRegistryNumber", SqlDbType.Int)
cmd.Parameters.Add("@LicenseNameArabic", SqlDbType.NVarChar)
cmd.Parameters.Add("@LicenseNameEnglish", SqlDbType.NVarChar)
cmd.Parameters.Add("@LegalForm", SqlDbType.NVarChar)
cmd.Parameters.Add("@ExpiryDate", SqlDbType.Date)
cmd.Parameters.Add("@LicenseOwner", SqlDbType.NVarChar)
cmd.Parameters.Add("@LicenseOwnerNationality", SqlDbType.NVarChar)
cmd.Parameters.Add("@LicenseType", SqlDbType.NVarChar)
cmd.Parameters.Add("@LicenseActivities", SqlDbType.NVarChar)
cmd.Parameters.Add("@LicenseAddress", SqlDbType.NVarChar)
cmd.Parameters.Add("@Phone", SqlDbType.NVarChar)
cmd.Parameters.Add("@Fax", SqlDbType.NVarChar)
cmd.Parameters.Add("@Email", SqlDbType.NVarChar)
cmd.Parameters.Add("@LicenseStatus", SqlDbType.NVarChar)
retval = dm.executeReader(cmd, dr)
Return retval
End Function
And Also I have Business Layer and Code Like so :
Public Function Search_Licenses_By_Number(ByVal LicenseNumber As Integer) As Integer
p.Search_Licenses_By_Number(cmd, dr, LicenseNumber)
Return p.Search_Licenses_By_Number(cmd, dr, LicenseNumber)
End Function
i have form contain 14 textboxs and 1 datetime picker and 1 button
what i want to is when press search button it display the recode in textboxs depend on LicenseNumber that entred in textbox1
the button code like so :
Dim retval As Integer = p.Search_Licenses_By_Number(txtLicensesNumber.Text)
txtLicensesNumber.Text = p.Search_Licenses_By_Number("LicenseNumber")
CentralRegistryNumber.Text = p.Search_Licenses_By_Number("CentralRegistryNumber")
txtLicensesNameArabic.Text = p.Search_Licenses_By_Number("LicenseNameArabic")
txtLicensesNameEnglish.Text = p.Search_Licenses_By_Number("LicenseNameEnglish")
LegalForm.Text = p.Search_Licenses_By_Number("LegalForm")
ExpiryDate.Value = p.Search_Licenses_By_Number("ExpiryDate").ToString
LicenseOwner.Text = p.Search_Licenses_By_Number("LicenseOwner")
LicenseOwnerNationality.Text = p.Search_Licenses_By_Number("LicenseOwnerNationality")
txtLicensesType.Text = p.Search_Licenses_By_Number("LicenseType")
LicenseActivities.Text = p.Search_Licenses_By_Number("LicenseActivities")
txtLicensesAddress.Text = p.Search_Licenses_By_Number("LicenseAddress")
LicensePhone.Text = p.Search_Licenses_By_Number("Phone")
LicenseFax.Text = p.Search_Licenses_By_Number("Fax")
LicenseEmail.Text = p.Search_Licenses_By_Number("Email")
LicStatus.Text = p.Search_Licenses_By_Number("LicenseStatus")
The Error Iam Getting is " Procedure Search_Licenses_By_Number has no parameters and arguments were supplied. "
Kind Regards
Salem