When you're getting (Saving changes is not permitted. The changes that you have made require the following tables to be dropped and re-created.
You have either made changes to a table that can't be re-created .......) this error when Alter your table..etc.
FIXED:
1 .Microsoft Sql Server Management Studio ->Options -> Designers ->
Prevent saving changes that require the table re-creation
UnCHECK its.
JessKee's Study notes
讓學習高階語言的朋友們,不必那麼辛苦,學習應該需要有對的方向! 2012-2013 ---- Php developer at Mad Solution Shd Bhd. 2013 (Currently) ----> Analyst at PurpleConnect Shd Bhd.(Dynamic CRM)
Friday, 10 May 2013
Saturday, 27 April 2013
C# Passing multiple parameter to a method with PARAMS
With c# param you can passing comma-separated list of arguments to your "Method".
Here i show an example with SUM method,Sum method accept a comma-separated list of arguments.
Example
Here i show an example with SUM method,Sum method accept a comma-separated list of arguments.
Example
class multiple_ParameterWithParam { public static int SUM(params int[] val) { int totalSum = 0; for (int i = 0; i < val.Length; i++) { totalSum += val[i]; } return totalSum; } static void Main() { Console.WriteLine("Total Sum (1-3) = {0}", SUM(1, 2, 3)); Console.WriteLine("Total Sum (1-6) = {0}", SUM(1,2,3,4,5,6)); Console.ReadLine(); } }
Labels:
C#
Monday, 22 April 2013
Introduce C# Collections
Collection that provides by .Net Framework have stacks, queues, lists, and hash tables. Collection classes are defined under System.Collections or System.Collections.Generic namespace.
At more complex, an object holds references to many other objects. The collections we often using is List and Dictionary.
Different between stacks, queues, lists, and hash tables
Declare a Dictionary
When you Create a Dictionary instance, you needed to pass in <TYPE,TYPE>,to tell that which type of Dictionary you want to Create.See Also GENERICS
Eg
Example(Here i'm using Dictionary)
Example above i'm create a Dictionary to store Owner and Car Plate Number .Then output the information.
At more complex, an object holds references to many other objects. The collections we often using is List and Dictionary.
Different between stacks, queues, lists, and hash tables
Declare a Dictionary
When you Create a Dictionary instance, you needed to pass in <TYPE,TYPE>,to tell that which type of Dictionary you want to Create.See Also GENERICS
Eg
Dictionary<TYPE, TYPE> objectInstance = new Dictionary<TYPE, TYPE>();
Example(Here i'm using Dictionary)
using System; using System.Collections.Generic; using System.Collections; using System.Linq; using System.Text; namespace IntroduceCollection { class IntroduceCollection { static void Main() { Dictionary<string, string> carPlateNum = new Dictionary<string, string>() { {"john", "JKE 1333"}, {"jess", "QQ 1314"}, {"apple", "JK 8888"}, {"jack", "USS 1555"}, {"alice","AC 6666"} }; // Using LIST to store car OwnerName List<string> ownerName = new List<string>(carPlateNum.Keys); /* Output all the CarPlate Data * * */ Console.WriteLine("Owner\tPlate Number"); foreach (string name in ownerName) { Console.WriteLine("{0}\t{1}", name, carPlateNum[name]); } //end Output with using LIST //Direct output Console.WriteLine("Foreach looping Output content of Dictionary"); foreach (KeyValuePair<string, string> carInfo in carPlateNum) { Console.WriteLine("{0}\t{1}", carInfo.Key, carInfo.Value); } Console.ReadLine(); } } }
Example above i'm create a Dictionary to store Owner and Car Plate Number .Then output the information.
Labels:
C#
Sunday, 21 April 2013
Introduce C# Generics
Generics is a powerful feature of C#. Generics allow you to define type-safe classes without compromising type
safety, performance, or productivity.
Lets think about example
Example
With this example ,we can easily add to the list, but this convenience comes at a cost.
Code above will pass compile,but will failed at run-time.
Generics Example
Conclusion: With Generics you can produce type safety code + reusable.
Remind: This feature is not often useful when you'r coding.You rarely need to create your generic types because .net Framework contains many useful classes already.
Reference from MSDN.
Example code from MSDN.
Lets think about example
Example
using System; using System.Collections.Generic; using System.Collections; using System.Linq; using System.Text; namespace GenericIntro { class GenericIntro { private class ExampleClass { } static void Main() { System.Collections.ArrayList list = new System.Collections.ArrayList(); // Add an integer to the list. list.Add(3); list.Add(2); list.Add(6); // Add a string to the list. This will compile, but may cause an error later. list.Add("It is raining in Redmond."); //illegal int t = 0; // This causes an InvalidCastException to be returned. foreach (int x in list) { t += x; } } } }
With this example ,we can easily add to the list, but this convenience comes at a cost.
Code above will pass compile,but will failed at run-time.
Generics Example
// The .NET Framework 2.0 way to create a list Listlist1 = new List (); // No boxing, no casting: list1.Add(3); // Compile-time error: // list1.Add("It is raining in Redmond.");
Conclusion: With Generics you can produce type safety code + reusable.
Remind: This feature is not often useful when you'r coding.You rarely need to create your generic types because .net Framework contains many useful classes already.
Reference from MSDN.
Example code from MSDN.
Labels:
C#
Objects is like arrays by using "Indexers"
I am here give some introduce about C# object indexers like array.
Define Object indexer
"this" keyword + [ ] is used for defining a object indexer.Take this as a example,you'll get a more complete example shortly.
This example is using Collection in .Net Framework to implement Get or Set Properties dynamically.
Example Output
This C# feature is useful at advanced C# software development. Just take as a note.Its can be using to design internal the "software pattern", you also can Apply in your software depend on your creative thinking.
Define Object indexer
"this" keyword + [ ] is used for defining a object indexer.Take this as a example,you'll get a more complete example shortly.
class yourCls{ public object this[String passIn] // Declare Indexer. { get{} set{} } } yourCls indexerCls = new indexerCls(); indexerCls["ObjectIndexer"] = "Sample"; //you can using indexer like this.Example with Collection
This example is using Collection in .Net Framework to implement Get or Set Properties dynamically.
using System; using System.Collections.Generic; using System.Collections; using System.Linq; using System.Text; namespace ObjectindexerWithCollection { class DynamicProperties { public Dictionary<string, string> hData = new Dictionary<string, string>(); //Declare dictionary to handler properties. public string this[string parameterName] { get { return this.hData[parameterName]; } set { this.hData[parameterName] = value; } } } class Program { static void Main(string[] args) { DynamicProperties lbx = new DynamicProperties(); lbx["test"] = "Object "; //set Indexer lbx["test1"] = "Indexers";//set Indexer Console.WriteLine("Here is the sample of {0}{1}", lbx["test"], lbx["test1"]); //get Indexer Console.ReadLine(); } } }
Example Output
This C# feature is useful at advanced C# software development. Just take as a note.Its can be using to design internal the "software pattern", you also can Apply in your software depend on your creative thinking.
Labels:
C#
Subscribe to:
Posts (Atom)