[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

passing string value to Data Access Layer

Posted on 2013-01-23
2
Medium Priority
?
426 Views
Last Modified: 2013-02-11
Hi All

Am just stuck to pass my string variable to my Data Access layer.

here is my main console

     class Program
    {
        static void Main(string[] args)
        {  
                String BookingTime="1000345";
                var BookingStart = new SchedSAPEntities.ResourceBookingEntity.ResourceBooking(string Bookingtime);
       }
}

SchedSAPEntities.ResourceBookingEntity.ResourceBooking(string Bookingtime);//Am trying to pass the string variable (1000345) to ResourceBooking method.

Here is my Data access Layer

     public class ResourceBookingEntity
    {
        public class ResourceBooking
        {
            private String _PRJ_ID;
                       
            public ResourceBooking(String APRJ_ID )
            {
                _PRJ_ID = APRJ_ID;
                
            }
            public String PRJ_ID { get { return _PRJ_ID; } }
            }
    }


      public class ResourceBookingList : List<SchedSAPEntities.ResourceBookingEntity.ResourceBooking>
        {
            public ResourceBookingList(SchedwinEntities db)
            {
                    var query =
                    (from PROJECTS in db.PROJECTS
                     join WOes in db.WOes on PROJECTS.PRJ_ID equals WOes.PRJ_ID
                     join SEVT_EX in db.SEVT_EX on SEVTs.SESID equals SEVT_EX.SESID into SEVT_EX_join
                     from SEVT_EX in SEVT_EX_join.DefaultIfEmpty()
                     where
                       (new string[] { "1", "2" }).Contains((PROJECTS.STAT.TrimEnd()).TrimStart()) &&
                       (WOes.STAT.TrimEnd()).TrimStart() == "6" &&
                       ((SEVTs.RESTYPE == 5 ||
                       SEVTs.RESTYPE == 0) &&
                       **SEVTs.T_START.TrimStart() == BookingStart**//Am trying to pass the value here
                     orderby
                       PROJECTS.PRJ_ID,
                       WOes.WONUM
                     select new
                     {
                         PROJECTS.PRJ_ID,
                                                 
                     }).Take(10);
                foreach (var r in query)
                    Add(new SchedSAPEntities.ResourceBookingEntity.ResourceBooking(
                        r.PRJ_ID, r.USER3, r.USER9, r.WONUM));
                        var ResourceBooking = query.ToList();
            }
        }

Open in new window

0
Comment
Question by:Sha1395
2 Comments
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 38812935
Are you receiving an error of some sort?
0
 
LVL 29

Accepted Solution

by:
Göran Andersson earned 2000 total points
ID: 38814059
You only specify the data type when you define the method, not when you call it.

Remove the string keyword:

var BookingStart = new SchedSAPEntities.ResourceBookingEntity.ResourceBooking(Bookingtime);

Open in new window

0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question