I want to pass two variables from aspx page to a function in webservice, then need to get return string, if string having content show (alert) else not required to show, please refer my code here,
This is my Aspx code, when the client change the date then, I want to pass parameters viz.,
Lbl_empid, txt_ResignDate to the following function (ref my below-mentioned webservice code)
<WebMethod()> Public Function Get_ValiHoliDays(ByVal ip_empid As Integer,_ ByVal ip_date As Date, ByVal op_val As String) As String()
Dim sCon As New SqlConnection(DBConnectionString)
Dim param As SqlParameter
Dim sCmd As New SqlCommand(selectSQL, sCon)
Try
sCon.Open()
sCmd.CommandType = CommandType.StoredProcedure
sCmd.CommandText = "HRMSP_Validate_OffHoliday_Dates"
sCmd.Parameters.Clear()
sCmd.Parameters.Add(New SqlParameter("@i_SP_AttribuId", SqlDbType.Int)).Value = 1
sCmd.Parameters.Add(New SqlParameter("@i_EmployeeID", SqlDbType.Int)).Value = ip_empid
sCmd.Parameters.Add(New SqlParameter("@i_ValiDate", SqlDbType.Date)).Value = ip_date
param = New SqlParameter("@o_ErrorStatus", SqlDbType.Int) With {
.Direction = ParameterDirection.Output
}
sCmd.Parameters.Add(param)
adapter.Fill(dsDataset)
If sCmd.Parameters("@o_ErrorStatus").Value = 1 Then
op_val = (dsDataset.Tables(0).Rows(0).Item(0).ToString)
ElseIf sCmd.Parameters("@o_ErrorStatus").Value = 2 Then
op_val = ""
End If
Finally
sCon.Close()
End Try
End Function
.NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today.
Member
359 Points
526 Posts
How to pass vals to webservice funciton
Feb 26, 2020 04:45 AM|ayyappan.CNN|LINK
Hi,
I want to pass two variables from aspx page to a function in webservice, then need to get return string, if string having content show (alert) else not required to show, please refer my code here,
This is my Aspx code, when the client change the date then, I want to pass parameters viz., Lbl_empid, txt_ResignDate to the following function (ref my below-mentioned webservice code)
Dept of ICT.
Mark post(s) as "Answer" that helped you
Contributor
3730 Points
1420 Posts
Re: How to pass vals to webservice funciton
Feb 27, 2020 05:50 AM|yij sun|LINK
Hi ayyappan.CNN,
Accroding to your description,I suggest you could create ajax to call the webservice function.And in the webmethod,you need to return the data.
More details,you could refer to below article:
https://www.encodedna.com/2013/05/pass-multiple-para-to-webmethod.htm
https://www.codeproject.com/Questions/1103159/Asp-net-pass-multiple-parameters-to-jquery-ajax-ca
Best regards,
Yijing Sun