Posts

Donate

Visual Studio 2008 Failed Install On WIndows 8 Operating System

Solution: Turn on .NET Framework 3.5 which is built-in Windows 8. Make sure windows updates is turned on also. Cheers!

Change BIOS Boot Options For Acer Aspire V5-431P/471P

Image
Hello and Good afternoon! Here's a useful Acer Aspire V5-431P/471P Tip that is to Change BIOS Boot Options for Acer Aspire V5-431P/471P (I Series) 1. Restart/Shutdown the Laptop 2. Tap F2 key on startup 3. When BIOS interface appears, go to Boot Menu 4. Change Boot Mode to Legacy BIOS. 5. Restart Again the laptop and perform step 2. 6. Set the Boot Priority of Devices using F5/F6.

SQL Server Function Date Range Example

The function below retrieves the top Freight amount specified by date range values use CompanySales IF object_id (N 'dbo.GetTopFreightValueRange' , N 'FN' ) IS NOT NULL drop function GetTopFreightValueRange go create function GetTopFreightValueRange ( @startDate nvarchar(50), @endDate nvarchar(50) ) returns decimal(10,2) as begin declare @ result varchar(50) set @ result = ( select FreightAmount from dbo.Orders where CONVERT (VARCHAR(10), ShippedDate, 120) >= @startDate and CONVERT (VARCHAR(10), ShippedDate, 120) <= @endDate ) return @ result end go -- select dbo.GetTopFreightValueRange('1996-11-01','1996-11-30') as freight_value;

SQL Server Function To Return Amount As Decimal

Here's a simple function that will return the freight amount in decimal format. use Your_Database_Name if object_id (N 'dbo.getFreightValue' , N 'FN' ) is not null drop function getFreightValue go create function getFreightValue ( @salesID nvarchar(50) ) returns decimal(10,2) as begin declare @ result varchar(50) set @ result = ( select Freight from dbo.Orders where OrderID = @salesID ) return @ result end go -- run function -- select dbo.getSomeValue(10248) as freight_value; Cheers!

Castle Windsor - Could Not Perform FindAll() For (Model) Using ActiveRecordBase in Castle.ActiveRecord ORM

When running a simple asp.net mvc project, I encountered an error which states the Model.FindAll() could not be performed. Model is a class that maps to a database table. After tracing my codes, I found out that I have mispelled the database name in my web.config as specified below: <add key= "connection.connection_string" value= "Data Source=MyComputerStation\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Blogs.mdf;Integrated Security=True;User Instance=True" /> What I did was change the database name from Blogs to Blog . That's it! :) Greg

How To Set Connection String In Properties.Settings Of ASP.NET Class Library Project

Image
Usually, we set an asp.net connection string directly in the app.config. However, we can also do it Properties.Settings. As soon as we saved the name and value, it will reflect in the app.config. Here's a sample image as reference: Cheers!

Pass By Reference Not Allowed In UI Threading Of Windows Forms In C#

The code below does not allow pass by reference to be used in UI threading particularly method Invoker. private void ShowPassMeta( ref int passedSound) { if (lblPassSoundex.InvokeRequired) { lblPassSoundex.Invoke((MethodInvoker) delegate { ShowPass( ref passedSound); }); } else { lblPassSoundex.Text = (++passedSound).ToString(); } } The solution is to store the method parameter in another variable as shown below: private void ShowPassMeta( ref int passedSound) { var passedSound1 = passedSound; if (lblPassSoundex.InvokeRequired) { lblPassSoundex.Invoke((MethodInvoker) delegate { ShowPassMeta( ref passedSound1); }); } else { lblPassSoundex.Text = (++passedSound1).ToString(); } } Cheers!

Error 1064 Insert Statement Using MySQL Parameters In C#

Good evening! The code above has a database field called desc which is a reserved word in SQL as an order by criteria. dbQuery = String.Format( @"INSERT INTO accom_temp_hotelagencies(hotel_id, agency_id, hotel_webid, desc)VALUES(?HotelId, ?AgencyId, ?HotelWebId, ?Description)" ); The solution is to enclose the field name desc with an acute or back quote. as shown in the code below: dbQuery = String.Format( @"INSERT INTO accom_temp_hotelagencies(hotel_id, agency_id, hotel_webid, `desc`)VALUES(?HotelId, ?AgencyId, ?HotelWebId, ?Description)" ); Cheers!

LINQ Slow Performance In Checking Almost 1 Million Or Large Data (Optimization Problem) In C#

I have a code below which returns an object after satisfying a given condition. 1 2 3 result = listCountryStateCollection.Find(e => (e.CountryName.ToLower().Trim() == accomTempHotel.CityProvinceCountryName[0].CountryName.ToLower().Trim()) && (e.StateName.Trim().ToLower() == accomTempHotel.CityProvinceCountryName[0].StateName.ToLower().Trim()) && (e.SuburbCityName.Trim().ToLower() == accomTempHotel.CityProvinceCountryName[0].SuburbCityName.ToLower().Trim())); The problem I encountered was that, it was slow in getting the desired results. After doing optimization/code checking I came up with a simple solution. The solution is not to include string manipulations in your LINQ but instead the processing should be done using variables as defined below: 1 2 3 4 5 6 string country = accomTempHotel.CityProvinceCountryName[0].CountryName.ToLower().Trim(); string state = accomTempHotel.CityProvinceCountryName[0].StateName.ToLower().Trim(); string s

Debugging jQuery Or Javascript Code Not Working In ASP.NET MVC 3 (VS 2010)

In my MVC 2 post here: Debuggin jquery/javascript code , the workaround was to isolate the javascript codes in a separate .js file. However, there's another way to add breakpoints by referring to localhost html file in the solutions explorer as stated in this website link: Debuggin javascript with IE9/Visual Studio 2010 MVC 3 Greg

Donate