Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

Error using collection classes

$
0
0

Go through my code....

public List<Remarks1> fillRemarks1List(RemarksRequest oei)
        {
            List<Remarks1> mylist = new List<Remarks1>();
            SqlConnection sqlConn = new SqlConnection(strConn);
            sqlConn.Open();
            SqlCommand commInfo = new SqlCommand();
            commInfo.CommandType = CommandType.StoredProcedure;
            commInfo.CommandText = "dbo.SPQueryRemList";
            commInfo.Connection = sqlConn;

            commInfo.Parameters.Add(new System.Data.SqlClient.SqlParameter("@reqNo", System.Data.SqlDbType.Char, 20));
            commInfo.Parameters["@reqNo"].Value = "0200000458";//oei.reqNo1.ToString().Trim();
            commInfo.Parameters.Add(new System.Data.SqlClient.SqlParameter("@lgnId", System.Data.SqlDbType.Char, 10));
            commInfo.Parameters["@lgnId"].Value = oei.loginid.ToString().Trim();

            SqlDataReader rdr4;
            try
            {
                rdr4 = commInfo.ExecuteReader();

                while (rdr4.Read())
                {
                    mylist.Add(new Remarks1(rdr4.GetString(7).Trim(), rdr4.GetString(8).Trim(), rdr4.GetString(0).Trim(), rdr4.GetString(5).Trim()));
                }

                rdr4.Close();
            }
            catch (Exception ex)
            {

            }
            finally
            {
                commInfo.Dispose();

            }
            sqlConn.Close();

            return mylist;


        }

________________________________________________________________________________

MY ISERVICE :
-------------

[OperationContract]
        [WebInvoke(Method = "POST",
            RequestFormat = WebMessageFormat.Json,
            ResponseFormat = WebMessageFormat.Json,
            BodyStyle = WebMessageBodyStyle.Wrapped,
            UriTemplate = "remarksList")]
        List<Remarks1> fillRemarks1List(RemarksRequest oei);
________________________________________________________________________________
HERE IS MY AJAX CALL TO USE THE SERVICE:
----------------------------------------

urlToHandler = 'http://localhost/WcfService/Service1.svc/remarksList';
    
var tempyear="";
 
$.ajax({
                url: urlToHandler,
data:JSON.stringify({oei:{"loginid":userid}}),
               type: 'POST',
dataType:"json",
   contentType: 'application/json',
                success: function(data) {    
alert(data.fillRemarksListResult);

$.each(data.fillRemarksListResult,function(key,val){


            
});
                },
                error: function(data, status, jqXHR) {                       
                    alert('There was an error.');
                }
            }); // end $.ajax

});

I have the following errors...

(rdr4).Depth threw an exception of type (System.InvalidOperationException)

(rdr4).FieldCount threw an exception of type (System.InvalidOperationException)

(rdr4).Hasrows threw an exception of type (System.InvalidOperationException)

I need to populate those remarks in my html page !!


Viewing all articles
Browse latest Browse all 5678

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>