//add this using System.Linq; //or this using System.Data.Entity;
world wide web development problems asp net php html xhtml css javascript jquery w3dproblems
Thursday, September 25, 2014
Cannot convert lambda expression to type 'string' because it is not a delegate type
Wednesday, September 24, 2014
An ASP.NET setting has been detected that does not apply in Integrated managed pipeline mode
<configuration> <system.webServer> <validation validateIntegratedModeConfiguration="false"/> </system.webServer> </configuration>
Friday, September 19, 2014
Cannot Load File C:\Program Files (x86)\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Common\SAP BusinessObjects Enterprise XI 4.0\win64_x64\dotnet1\crdb_adoplus.dll
In app.config file
<startup useLegacyV2RuntimeActivationPolicy="true"> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/> </startup>
Wednesday, September 17, 2014
Delete all data in SQL Server database
-- disable referential integrity EXEC sp_MSForEachTable 'ALTER TABLE ? NOCHECK CONSTRAINT ALL' GO EXEC sp_MSForEachTable 'SET QUOTED_IDENTIFIER ON; DELETE FROM ?' GO -- enable referential integrity again EXEC sp_MSForEachTable 'ALTER TABLE ? WITH CHECK CHECK CONSTRAINT ALL' GO -- Reseed identity columns EXEC sp_MSForEachTable 'DBCC CHECKIDENT (''?'', RESEED, 0)'
DELETE failed because the following SET options have incorrect settings: QUOTED_IDENTIFIER
-- disable referential integrity EXEC sp_MSForEachTable 'ALTER TABLE ? NOCHECK CONSTRAINT ALL' GO EXEC sp_MSForEachTable 'SET QUOTED_IDENTIFIER ON; DELETE FROM ?' GO -- enable referential integrity again EXEC sp_MSForEachTable 'ALTER TABLE ? WITH CHECK CHECK CONSTRAINT ALL' GO -- Reseed identity columns EXEC sp_MSForEachTable 'DBCC CHECKIDENT (''?'', RESEED, 0)'
Tuesday, September 16, 2014
Console.WriteLine equivalent in ASP.Net
System.Diagnostics.Debug.WriteLine("Message");
Validation failed for one or more entities. See 'EntityValidationErrors' property for more details
try { //........... dc.SaveChanges(); } catch (DbEntityValidationException ex) { foreach (var eve in ex.EntityValidationErrors) { System.Diagnostics.Debug.WriteLine("Entity of type \"{0}\" in state \"{1}\" has the following validation errors:", eve.Entry.Entity.GetType().Name, eve.Entry.State); foreach (var ve in eve.ValidationErrors) { System.Diagnostics.Debug.WriteLine("- Property: \"{0}\", Error: \"{1}\"", ve.PropertyName, ve.ErrorMessage); } } }Look for errors in the output window during debugging
LINQ Lamda Syntax - Selecting multiple columns
use the new keyword
var parent = dc.Forms.Select(f => new { f.FormID, f.ModuleId })
How to check if string contains a string from a string array
Using LINQ Any
string[] rpts = { "rpt", "rtp", "Rpt", "Report" };
using if and any to check whether string contains any item from array
if (rpts.Any(url.Contains))
string[] rpts = { "rpt", "rtp", "Rpt", "Report" };
using if and any to check whether string contains any item from array
if (rpts.Any(url.Contains))
{
........
}
Monday, September 15, 2014
Run Transact-SQL Script Files Using sqlcmd
sqlcmd -S myServer\instanceName -i C:\myScript.sql
Monday, September 8, 2014
Bind a Dictionary to a DropDownList
Dictionary<string, string> openWith = new Dictionary<string, string>(); // Add some elements to the dictionary. There are no // duplicate keys, but some of the values are duplicates. openWith.Add("txt", "notepad.exe"); openWith.Add("bmp", "paint.exe"); openWith.Add("dib", "paint.exe"); openWith.Add("rtf", "wordpad.exe"); DDL.DataSource = openWith .Select(r => new KeyValuePair<string, string>(r.Key, r.Value)) .ToList(); DDL.DataTextField = "Key"; DDL.DataValueField = "Value"; DDL.DataBind();
call change() event handler if I select radio button programatically
$(function () {
$('input[name=type]').change(function () { alert($(this).val()); }); $('input[value=SV]').attr('checked', 'checked').trigger('change'); });
Saturday, September 6, 2014
EF5: Cannot attach the file ‘{0}' as database '{1}'
Go to View -> SQL Server Object Explorer and delete the database from the (localdb)\v11.0 subnode!
Delete the database
Delete the database
The model backing the context has changed since the database was created
Database.SetInitializer<YourDbContext>(null);
or
for later versionsDatabase.SetInitializer(new DropCreateDatabaseIfModelChanges<YourDbContext>());
Subscribe to:
Comments (Atom)