Skip to content
Loading
  
  •   
  •   
  • "text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js">  
  • "text/javascript" src="https://cdn.datatables.net/buttons/1.4.2/js/dataTables.buttons.min.js">  
  • "text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.32/pdfmake.min.js">  
  • "text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.32/vfs_fonts.js">  
  • "text/javascript" src="https://cdn.datatables.net/buttons/1.4.2/js/buttons.html5.min.js">  
  •   
  •   
  • 0
  • Abdalla Elawad
    0
    This Is WebService
     
    1. using System;  
    2. using System.Collections.Generic;  
    3. using System.Linq;  
    4. using System.Web;  
    5. using System.Web.Services;  
    6. using System.Data;  
    7. using System.Data.SqlClient;  
    8. using System.Configuration;  
    9. using System.Web.Script.Serialization;  
    10. namespace IT_Inventory  
    11. {  
    12. ///  
    13. /// Summary description for Item_WebService  
    14. ///  
    15. [WebService(Namespace = "http://tempuri.org/")]  
    16. [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]  
    17. [System.ComponentModel.ToolboxItem(false)]  
    18. // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.  
    19. // [System.Web.Script.Services.ScriptService]  
    20. public class Item_WebService : System.Web.Services.WebService  
    21. {  
    22. [WebMethod]  
    23. public void GetItem()  
    24. {  
    25. string cs = ConfigurationManager.ConnectionStrings["Con_Inventory"].ConnectionString;  
    26. List listItems = new List();  
    27. using (SqlConnection con = new SqlConnection(cs))  
    28. {  
    29. SqlCommand cmd = new SqlCommand("DateTable_Select_Item", con);  
    30. cmd.CommandType = CommandType.StoredProcedure;  
    31. con.Open();  
    32. SqlDataReader rdr = cmd.ExecuteReader();  
    33. while (rdr.Read())  
    34. {  
    35. Class_Item EM2 = new Class_Item();  
    36. EM2.Model = rdr["Model"].ToString();  
    37. EM2.PartNo = rdr["PartNo"].ToString();  
    38. EM2.ItemDesc = rdr["ItemDesc"].ToString();  
    39. EM2.ReceivedDate = rdr.GetFieldValue(rdr.GetOrdinal("ReceivedDate")).ToString();  
    40. listItems.Add(EM2);  
    41. }  
    42. }  
    43. JavaScriptSerializer js = new JavaScriptSerializer();  
    44. Context.Response.Write(js.Serialize(listItems));  
    45. }  
    46. }  
    47. } 
    0
  • Salman Beg
    0
    Hi Abdalla. I understood what is the real cause of the problem. When you run the application from your pc it will work because that database which you are using that is present in your pc only so that it can directly access that db and bind that grid. But when you run that same application from other PC's it will try to access that db but that db is not accessible and it is throwing exception.So due to that reason the data will not bind in other PC's. So to run the application in any PC's, take a server connection string and put that in your web.config file and it will work fine. If it helps Mark as answer. Thanks.
    0
  • Abdalla Elawad
    0
    Dear Salman
    Sorry , The connection String working good , i can login to application but i can not browsing data from table exactly from DataTable
     
    thanks 
    0
  • Salman Beg
    0
    If that is the case then put try catch block and inside catch block if you get any error then insert that exception details into a table. After that publish again. Run application in other PC's and when the data not load then goto your db and in that particular table check what error you are getting. This is the only way you can find out the real cause of the issue. thanks
    0
  • 0
    javascript is not working properly on IIS
    0
  • 0
    hello abdalla  diid solv your problimes  if you get solv please let me know buecoues  i looking fot it befor 5 days  nut still i don't know why this Datatable not working onine when i run it on local mischane  it fine work well 
    so if you have any fix  please let' me know that  thanks 
    0