One months of study, the basic part is basically over, now began to strengthen the basic part of the review1. CommentsSingle line comment//Comment Line codeThe contents of a multiline comment/* Comment */Documentation comments///annotation classes and methodshtml2. Naming specification1), Camel Camel naming specification: first letter lowercase first words, the remaining words capitalized, variables, fieldsint age string Name char gender ... string hightschoolint _chinese (must be underlined in
ADO. NET review-write your own SqlHelper class, ado. netsqlhelper
Today, I reviewed the basics of ADO. NET and sorted out the points I think:
Compile the SqlHelper class to facilitate the execution of database statements. In this case, you can directly call the method encapsulated in the SqlHelper class. At present, most companies require you to write a SqlHelper
database (for multiple SQL executions); List of strongly typed lists of objects accessed by the index. Summary: 1) Splicing SQL string: String to be used, StringBuilder 2) Universal parameter transfer: List, HashTable 3) Special class (link other databases with different approximate class libraries): Parameter passing class, SqlParameter; Database connection class, SqlConnection; Transaction class, SqlTransaction;SqlCommand, command execution class; SqlDataAdapter, command execution and link cl
. Fortunately, a database request simply executes a simple stored procedure that returns only a few rows from a table with a few simple records. Try out some different polltime values for your application to find an ideal value to balance database access and data obsolescence. The minimum allowable polltime value is 500. ]connectionStringName is the database connection name that is configured in the Providername= "System.Data.SqlClient"/>Finally, the duration in the OutputCache directive is "999
depend on abstraction.ISP Interface Isolation principleCustomers should not be forced to rely on methods that they do not use. The interface belongs to the customer and does not belong to the class hierarchy in which it resides.REP Reuse Publishing Equivalence principleThe granularity of reuse is the granularity of the releaseCCP Common closure principleAll classes in the package should be closed together for changes of the same class nature. If a change affects a package, it will affect all cl
Richter conversion:1, subclasses can be assigned to the parent class2. If a child class object is loaded in the parent class, you can convert the parent class to a subclass object.3, as4, isIf a subclass inherits a parent class, the subclass can use the members inherited from the parent class in addition to its own members.However, the parent class can always use only its own members, not the members of the child classesSub-classes cannot use each other's members classProgram {Static voidMain
#region read the text of large files using StreamReader using (StreamReader sr = new string txt = null while (txt = Sr. ReadLine ())! = null ) { this . TextBox2.Text + = Txt+"
\r\n
; }} #endregion At first, I tried to solve the missing text of each line read "\ r \ n", so I used another method #regionA way to trouble//using (StreamReader sr = new StreamReader (OFD. FileName, Encoding.default))//{ //char[]
input and displays the number of students entered by the user, as well as the name of each student. Static voidMain (string[] args) {Liststring> namelist =Newliststring>(); while(true) {Console.WriteLine ("Please enter your name:"); stringName =Console.ReadLine (); Namelist.add (name); if(name. ToLower ()) = ="quit") { Break; }} Console.WriteLine ("you entered a total of: {0} Students, the names are:", Getnamesnum (NameList)-1); for(in
is passed in. 2. Method (function): Reusing static methods [Static] Console.ReadLine () can be called by the class name; Public Static classconsole{} Console static class, Console.WriteLine (this kind has 19 methods) can fully show the method overloaded method name the same method parameter type and number of different;3.returnReturns a value for the method, and a colleague can exit the program immediately. BreakExits the current loop,Continueexit this cycle. 4.voidNo type no return value; meth
profound Static voidMain (string[] args) { int[] arr =New int[ -]; //int[] arr = new INT[5]; //for (int i = 0; i //{ //Console.WriteLine (Arr[i]); //} while(true)//re-enter the user as soon as the error is entered, until it is correct { Try{Console.WriteLine ("are you going to print this array in a row of numbers? "); intUsernum =Convert.ToInt32 (Console.ReadLine ()); //Assign Value int[] NewArr =Fill (arr); /
Although a recent interview with a company, there are two choices, but the study can not be left behind. In fact, I also believe in their own. That is a little bit of satisfaction, but also know that they are really far away, the expected salary distance my goal is still a big cut, although the general undergraduate graduate salary is not very high. But I still want my life to be a little better. Maybe it's a little too material. Well, it's time to talk about your study. 1
Packaging
View(1) Function: Encapsulates a complex SELECT statement to make it easier to use(2) Syntax:Create/alter View NameAsSelect ...Delete: Drop view name(3) Use: The view name can be used as a table name for various query operations(4) Suggestions: Do not add, modify, delete through the view, the main query operationExample:1. Create a view:-- Create a View Create View Student_class--alterasselect studentinfo. * from Studentinfo Inner Join on Studentinfo.cid=classinfo.cidView Code2. Use:-- The vie
; Pooling=false"); Conn. Open (); Conn. Close (); Conn. Dispose (); } watch. Stop (); Label2. Text=Watch. Elapsedmilliseconds.tostring (); } }}View CodeConclusion:1. Each application in ADO maintains a pool of connection objects, which is not created each time it is used, but is first fetched from the pool and then used directly.New if not, reduces the time of each new build2. Create a collection space in memory to store idle objects,
using, the object's class must implement the Idisposeable interface.3. The nature of the using is actually Try-catch, the code in the using is generated in a try and the Disopose method of the calling object is written in the finally, so the Dispose method is called anyway.Five Serialization and deserializationcode example:1 namespaceserialization and deserialization2 {3 [Serializable]4 class Person5 {6 Public stringName {Get;Set; }7 Public intAge {Get;Set; }8
Parameters property, one parameter with the Add methodcmd. Parameters.Add (NewSqlParameter ("@name", TextBox1.Text)); Conn. Open (); inti =Convert.ToInt32 (cmd. ExecuteScalar ()); MessageBox.Show (i.ToString ()); } } }}View CodeParameterized statement execution procedure:(1) Open Database Tools ->profier tool (Database Analysis monitoring tool)(2) Execution code: Enter a ' or 1=1 or 1 = 'After clicking the button(3) Then look at the profiler.EX
{return_passenger;} Set{_passenger =value;} } PublicCar (stringBrandstringColorintpassenger):Base(brand, color) { This. Passenger =passenger; } Public Override voidSayHello () {Console.WriteLine ("I am the { 0} card {1} color sedan, the number of passengers is {2} people", This. Brand, This. Color, This. Passenger); } Public voidZaike () {Console.WriteLine ("{0} The car sits comfortably and the guests love to sit", This. Brand); } }.
calls the parent class's name method in the subclass2. Access modifier:Public: openly, publiclyPrivate: Accessible only within the current class, members of the class if no access modifier defaults to privateprocteced: Protected, can be accessed inside the current class, or in subclasses of the classInternal: Access modifiers that can be used to decorate classes are available in the current project only: internal and publicproctected internal:3. Common key WordsThis: The object of the current c
Salary {
get
;
set
;
public
override
void
Sayhi () {Console.WriteLine (
"
subclass Overrides parent class
"
); } }
Using the WinForm form, make a simple calculator, which defaults to "Please select". Requires a +,-,*,/ function, when the user clicks the "equals" button, if the input is not a number prompts the user: Public Partial classForm1:form { PublicForm1 () {InitializeComponent (); }
Bubble Sort,I did it two times. //1, 3, 4, 2, 6, 8, 7, 9, 0, 5//10 elements, starting with the first one, and then comparing each element in the array,//if nums[0]>nums[1] then two elements exchange position, and so on until Nums[9]//which is to compare 9 times .//the remaining 1 elements must be the smallest (ascending example) for(inti =0; I 1; i++) { //When the first number is compared, the number does not have to be compared, so j-1-i
1, using the method to achieve: There is a string array: {" Malone ", " Michael Jordan ", " Reggie Miller ", " Timdenken "," Kobe Bryant "}, Please output the longest string. Static voidMain (string[] args) { string[] STRs = {"Malone","Michael Jordan","Reggie Miller","Timdenken","Kobe Bryant" }; Console.WriteLine ("The longest string is: {0}", Exportstr (STRs)); Console.readkey (); } /// ///determine the longest element in a string array/// /// ar
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.