Interview essay SS

Source: Internet
Author: User

Sort it out later

==================================

Trigger

Differences between deleted and inserted data
Inserted
Store data after insert and update operations
Deleted
Store data before the delete and update operations
Note: The update operation is equivalent to performing the delete operation before the insert operation. Therefore, when performing the update operation, copy the data before the modification to the deleted table. After the modification
When the data is stored in the table to which the trigger acts, a copy is also generated to the insered table.

====================

Let's talk about two machine questions first.

1. Read text files with net and insert them into the database

2. Perform a login function to check that the username can only consist of numbers and letters.

They are easy to use.

I use three-tier architecture to implement dbhelper, Dal, BLL, model, and Web

A little strange

The first one is to read the string in Web. config. This is outdated and cannot be used to manually reference system. configuration. dll.

String S = configurationmanager. connectionstrings ["connection"]. connectionstring;

Or do not write as follows:

Server =.; database = test; uid = sa; Pwd = sa)

 

Or

Data Source = myserveraddress; initial catalog = mydatabase; user id = myusername; Password = mypassword;


* *** No code is available because I have no network or USB flash drives during the interview ***

Supplement: The following methods can be easier to remember.
Sqlconnectionstringbuilder in the namespace
Using system. Data. sqlclient
 SqlConnectionStringBuilder c = new SqlConnectionStringBuilder();            c.DataSource = ".";            c.InitialCatalog = "test";            c.UserID = "sa";            c.Password = "sa";

Information about ADO and transactions:

========================================================== ======================================

1.net Operating Mechanism

First use C #, VB.net to write code ---> then compile the program set (.exe ,. DLL [msil], metadata [data information], optional resources [images, sounds]) ----> the assembly is compiled by JIT (just-in-time only compiles msil as needed) for the machine code ----> Finally, the machine code is run by hosting the CLR.

Netframework includes: CLR common language runtime and FCL unified class library set

2. Reflection

Reflection is an important mechanism in. net. Through radiation, you can obtain. Net DLL at runtime. Members of every type (including class, structure, Delegate, interface, and enumeration) in EXE, including methods, attributes, events, and constructors.

3. Delegation and events

A delegate is a class that defines the type of a method so that the method can be passed as a parameter of another method. This way, the method is dynamically assigned to the parameter, it can avoid using the IF-else (switch) statement in a large number in the program, and make the program more scalable.

 

Define delegation:

Public Delegate void greetingdelegate (string name );

 

Event appears. It encapsulates the variables of the delegate type, so that, inside the class, whether you declare it as public or protected, it is always private. Outside the class, register the "+ =" and logout "-=" Access delimiters with the same access delimiters as you used when declaring an event.

 

Declaration event:

Public event greetingdelegate makegreet;


When to use delegation:

 

1. In multi-threaded programming, delegation is often used for asynchronous calls.

2. Delegate, event, and observer design mode release-subscription

3. In terms of design mode, delegation is similar to interfaces. interfaces are extended using components, and delegation directly uses a function to act as a component.

Gof abstracts it and is called the observer design pattern: the observer design pattern is used to define a one-to-many dependency between objects, so that when the state of an object changes, other Objects dependent on it are automatically notified and updated. The observer mode is a loosely coupled design mode.

 

From: http://www.cnblogs.com/JimmyZhang/archive/2007/09/23/903360.html

 

 

 

 

 

 

 

 

 

SQL

1. Question 1
Table
ID name
1 xiaosan
2 xiaosi
Table B
ID name sex
1 xiaowu boy
2 xiaoliu boy
3 Xiaoqi girl

Statement select * from a, B queries several records
Why are there six results ??

 

Answer:

Select * from T1, T2
Equal

Select * from T1 cross join T2

Cross join is also called the Cartesian product. In fact, it is used to multiply two tables.

Http://www.cnblogs.com/chenxizhang/archive/2008/11/10/1330325.html

 

2.

Question 2
Table
Id com
1 50
2 60
1 30
1 40
2 80
Table B
Id price
1 null
2 null

How to group the data in Table A according to the ID, find the com sum, and insert it into the price of the ID corresponding to table B?

For example, com with ID 1 and stomach 50 + 30 + 40 = 120
The price of Table B Id 1 is 120.
The same with ID 2...

Http://topic.csdn.net/u/20120526/11/b1733464-0aac-4d43-acf0-aa5dce6fff03.html? Seed = 620799569 & R = 78683988 # r_78683988

Answer:

Update T2 set price = s from T2, (select ID, sum (COM) s from T1 groupby ID) TMP where t2.id = TMP. ID

 

 

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.