Asked by:
Error When Get Result type DataTable form Web Service(ASMX)

Question
-
User-1344740560 posted
I have problem in my web app with asmx web service
when i return Data type of DataTable include column (Int) give my error and this message error (-1 is not a valid value for int64)
befor is work fine but after i install new visaul studio 2015 not working my code is :
in web service (ASMX) :
[WebMethod]
public DataTable allchant(string password)
{
tablechantTableAdapter chanttable = new tablechantTableAdapter();
DataTable dt = new DataTable();if(password=="thismyapp") dt = chanttable.GetData(); return dt; }
////////////////////////////////////////////////////////////////////////////////////////////
in my web app :
private void Btn2_Click(object sender, System.EventArgs e)
{
songservice.ZawamelService ws = new songservice.ZawamelService();ws.allchantAsync("thismyapp"); ws.allchantCompleted += Ws_allchantCompleted; } private void Ws_allchantCompleted(object sender, songservice.allchantCompletedEventArgs e) { DataTable dt = new DataTable(); dt = e.Result;}
Tuesday, August 8, 2017 6:05 AM
All replies
-
User-832373396 posted
Hi ibrahimdahan,
Based on your error information , I guess that your current thread have been cancelled, so please refer to code as shown below :
private void Ws_allchantCompleted(object sender, songservice.allchantCompletedEventArgs e) { DataTable dt = new DataTable(); if (e.Cancelled != true) { dt = e.Result; }
With Regards,
Angelina Jolie
Thursday, August 10, 2017 3:17 AM -
User-1344740560 posted
this code not solve my problem
Thursday, August 10, 2017 6:12 AM -
User1771544211 posted
Hi ibrahimdahan,
when i return Data type of DataTable include column (Int) give my error and this message error (-1 is not a valid value for int64)This error message is really strange, the range of int64 should be (-9,223,372,036,854,775,808 to +9,223,372,036,854,775,807), the -1 should be inside the range.
befor is work fineWhich eversion of VS do you use before? Perhaps this issue is related to the framework version or the some library version.
Best Regards,
Jean
Friday, August 11, 2017 6:52 AM -
User1120430333 posted
befor is work fine but after i install new visaul studio 2015 not working my code is :
https://dzone.com/articles/reasons-move-datatables
<copied>
DataTables are framework specific
<end>
Wednesday, August 16, 2017 6:36 PM