Quantcast
Channel: ADO.NET, Entity Framework, LINQ to SQL, NHibernate
Viewing all articles
Browse latest Browse all 1698

Linq to Sql Framework 4

$
0
0

Hi,

I'm using Linq-To-Sql.

Given the following code:

casefile.cs

publicpartialclasscasefile
{
     publicstaticint getCaseId(string asCaseNumber)
  
{
           int aiCaseId = -1;

    
using (CMSDataContext dc =new CMSDataContext())
    
{
                 aiCaseId = (from cin dc.casefile
                    
where c.case_nbr == asCaseNumber
                   
select c.case_id).FirstOrDefault();

        if (aiCaseId ==null || aiCaseId < 1)       
                {
                       thrownewException(String.Concat("Case Number ", asCaseNumber, " not found."));
       
}
          }

  return aiCaseId;
}
}

WebFormCMSCopyCommentEvent.aspx.cs

publicpartialclassWebFormCMSCopyCommentEvent : System.Web.UI.Page
{

      protectedvoid ButtonShowRecords_Click(object sender,EventArgs e)         
            {
                    //validate CaseIds
          
int aiCaseId1 =casefile.getCaseId(TextBoxCaseNo1.Text); errors here => CS0117: casefile does not get a definition for 'getCaseId'

      }
}

}

Thanks,

tinac99


Viewing all articles
Browse latest Browse all 1698

Trending Articles



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