error is cleared..but in the code i am passing the employee id,as per the employee id it will check the database and display the total days of the particular employee in the textbox...it shows me
Procedure or function 'datecheck' expects parameter '@startdate', which was not supplied.
this is my code...
connection.ConnectionString = ("Data Source=RIFAYEE-PC;Initial Catalog=OpalAsia1;Integrated Security=True")
connection.Open()
cmd.Connection = connection
cmd.CommandType = Data.CommandType.StoredProcedure
cmd.CommandText = "datecheck"
cmd.Parameters.Add("@Empid", SqlDbType.Int).Value = TextBox1.Text
TextBox4.Text = cmd.ExecuteScalar<br><br>i am having a textbox,if i type employee id and click the check it will display the result in the textbox
ALTER PROCEDURE datecheck
@EmpId int,@startdate datetime,@enddate datetime
as
begin
set nocount on
--here get fdate and tdate of that empid and other thing are same which you are using
Select startdate,enddate as totdays from finaldatecheck where EmpId = @EmpId
SELECT TOP (DATEDIFF(MONTH, @startdate, @enddate)+1) ROW_NUMBER() OVER
(ORDER BY [object_id])-1 FROM sys.all_objects
,
(
SELECT n.n, DATEADD(MONTH, n.n, m.m), DATEADD(MONTH, n.n+1, m.m)
FROM n, (SELECT DATEADD(DAY, 1-DAY(@startdate), @startdate)) AS m(m)
) Mon(n,fd,ld)
SELECT [Month] = DATENAME(MONTH, fd), [Days] = DATEDIFF(DAY, fd, ld)
- CASE WHEN @startdate > fd THEN (DATEDIFF(DAY, fd, @startdate)+1) ELSE 0 END
- CASE WHEN @startdate < ld THEN (DATEDIFF(DAY, @enddate, ld)-1) ELSE 0 END
FROM mon
end