1
Answer

Joining multiple tables in .net

Photo of anand s

anand s

8y
178
1
Hi All,
 
I am struggling to get this working in my applicaiton using C# MVC .Net framework 4.5,
 
Any help is greatly appriciated.
 
myProjects projects = db.myProjects.Find(id); 
 
Once the above line is executed, I need to join to 3 other tables for looking up values to get the discription of below attributes. 
 
ProjectStatus
ProgramName
Priority. 
 
Can you please help?
 
Regards,
Anand 

Answers (1)

0
Photo of Vulpes
NA 98.3k 1.5m 13y
Yes, if you know the format and you use (Try)ParseExact, then it doesn't matter about the culture:

      string s = "20110714";
      string f = "yyyyMMdd";
      DateTime dt;
      bool isValid = DateTime.TryParseExact(s, f, null, 0, out dt);
      if (isValid)
      {
         Console.WriteLine(dt);
      }
0
Photo of Jiteendra Sampathirao
NA 6.9k 1.5m 13y

hi,

use this:

string @DOB = DateTime.ParseExact(txtDOB.Text, "dd/MM/yyyy", System.Globalization.CultureInfo.CurrentUICulture.DateTimeFormat).ToString("MM/dd/yyyy");
string @DOJ = DateTime.ParseExact(txtDOJ.Text, "dd/MM/yyyy", System.Globalization.CultureInfo.CurrentUICulture.DateTimeFormat).ToString("MM/dd/yyyy");

modify this code to you requirement....