• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 429
  • Last Modified:

passing string value to Data Access Layer

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()
                       (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
                     select new
                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

1 Solution
käµfm³d 👽Commented:
Are you receiving an error of some sort?
Göran AnderssonCommented:
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

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

7 new features that'll make your work life better

It’s our mission to create a product that solves the huge challenges you face at work every day. In case you missed it, here are 7 delightful things we've added recently to monday to make it even more awesome.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now