İçeriğe geç

Tek Yorum

  1. Alper Alper

    Selam Bu metodu gride object data source olarak ekledim ama tam burada ds = ((DataSet)(cache[“names”]));>>>> “Object reference not set to an instance of an object.” bu hatayı alıyorum neden olabilir.

    public static class Listeler
    {
    static Cache cache = new Cache();
    public static DataSet Get(int isApproval, int jobTypeID, int isInvoiceApproval)
    {

    DataSet ds;
    ds = ((DataSet)(cache[“names”]));

    if (ds == null)
    {
    string path = “JobSma.xml”;
    var j = new JobRepositoy();
    j.Criteria = “SELECT ……………….. FROM …………………….. WHERE (Retailer.RetailerCode IS NOT NULL) AND (Jobs.IsApproval = @p1) AND (Jobs.JobTypeID = @p2) AND (Jobs.IsInvoiceApproval = @p3) ORDER BY Jobs.JobID DESC”;
    j.Parameters.AddWithValue(“@p1”, isApproval);
    j.Parameters.AddWithValue(“@p2”, jobTypeID);
    j.Parameters.AddWithValue(“@p3”, isInvoiceApproval);
    j.GetJoinedEntities().WriteXml(path);

    ds = new DataSet();
    ds.ReadXml(path);
    CacheDependency cd = new CacheDependency(path);
    cache.Insert(“names”, ds, cd);
    //Trace.Warn(“XML den Yüklendi!”);
    }
    else
    {
    //Trace.Warn(“Cache’den Yüklendi!”);
    }

    return ds;
    }
    }

Bir yanıt yazın