var statu = from x in dc.Attendance group x by 1 into g select new { ID = g.Key, Presents = g.Where(t => t.AttendanceStatus == "Present").Count(), Absents = g.Where(t => t.AttendanceStatus == "Absent").Count(), Leaves = g.Where(t => t.AttendanceStatus == "Leave").Count(), };
world wide web development problems asp net php html xhtml css javascript jquery w3dproblems
Tuesday, April 22, 2014
LINQ Case statement within Count asp net c#
Monday, April 21, 2014
unique key based on 2 or more columns in SQl Server 2005 or later
CREATE UNIQUE NONCLUSTERED INDEX IX ON Tbl ( Col1 , Col2 , Col3 ) WITH( IGNORE_DUP_KEY = OFF)
Breaking out of a nested loop c# aspnet
for (int i = 0; i < 100; i++) { for (int j = 0; j < 100; j++) { if (exit_condition) { // cause the outer loop to break: i = INT_MAX; // break the inner loop break; } } }
IIS - this configuration section cannot be used at this path (configuration locking?)
For Windows 7
For Windows Server 2012
- Click "Start button"
- in the search box, enter "Turn windows features on or off"
- in the features window, Click: "Internet Information Services"
- Click: "World Wide Web Services"
- Click: "Application Development Features"
- Check (enable) the features. I checked all but CGI.
For Windows Server 2012
- Configure Web Server(IIS) inside roles and features
- Add all features including dot net framework 4
Thursday, April 17, 2014
How to get name of all tables in ms sql database aspnet c#
public System.Collections.Generic.Dictionary<string, string> GetAllTables(System.Data.SqlClient.SqlConnection _connection) { if (_connection.State == System.Data.ConnectionState.Closed) _connection.Open(); System.Data.DataTable dt = _connection.GetSchema("Tables"); System.Collections.Generic.Dictionary<string, string> tables = new System.Collections.Generic.Dictionary<string, string>(); foreach (System.Data.DataRow row in dt.Rows) { if (row[1].ToString().Equals("BASE TABLE", StringComparison.OrdinalIgnoreCase)) //ignore views { string tableName = row[2].ToString(); string schema = row[1].ToString(); tables.Add(tableName, schema); } } _connection.Close(); return tables; }
Subscribe to:
Comments (Atom)