mardi 1 mai 2018

calling webservice with parameter inside java script file

i have two function in web service called name (newalbraik.asmx) the first function is:

[WebMethod]
        public void deletemsg(int id)
        {
            albraik.DAL.DAL dal = new albraik.DAL.DAL();
            dal.open();
            SqlParameter[] parm = new SqlParameter[1];
            parm[0] = new SqlParameter("@id", SqlDbType.Int);
            parm[0].Value = id;

            dal.execommand("deletemsg", parm);
            dal.close();

        }

when i calling function inside file java script like this albraik.newalbraik.deletemsg(id); it is working without any problem

the second function

[WebMethod]
        public DataTable GetEmpWorkLoad_mawwad_count_Followup_beweenthan_web(string empid)
        {

            albraik.DAL.DAL dal = new albraik.DAL.DAL();
            DataTable dt = new DataTable();

            SqlParameter[] parm = new SqlParameter[1];


            parm[0] = new SqlParameter("@empid", SqlDbType.VarChar,10);
            parm[0].Value = empid;
            dt = dal.selectdb("GetEmpWorkLoad_mawwad_count_Followup_beweenthan_web", parm);

            dal.close();
            return dt;

        }

when i calling function inside file java script like this document.getElementById('MainContent_ylwspn').innerText = albraik.newalbraik.GetEmpWorkLoad_mawwad_count_Followup_beweenthan_web('105'); it is not working and theres error say :

System.InvalidOperationException: Missing parameter: empid.
   at System.Web.Services.Protocols.ValueCollectionParameterReader.Read(NameValueCollection collection)
   at System.Web.Services.Protocols.UrlParameterReader.Read(HttpRequest request)
   at System.Web.Services.Protocols.HttpServerProtocol.ReadParameters()
   at System.Web.Services.Protocols.WebServiceHandler.CoreProcessRequest()

how to solving this problem?




Aucun commentaire:

Enregistrer un commentaire