C # naming rules and SQL Server naming rules

Source: Internet
Author: User

Everyone knows that writing a program should have a good naming convention, which should be posted for convenience of work.
1 ADO. Net naming rules

Data Type Abbreviated Data Type Standard naming example
Connection Con Connorthwind
Command CMD Cmdreturnproducts
Parameter Parm Parmproductid
Dataadapter Dad Dadproducts
Datareader DTr Dtrproducts
Dataset DST Dstnorthwind
Datatable Dtbl Dtblproduct
Datarow Drow Drowrow98
Datacolumn Dcol Dcolproductid
Datarelation Drel Drelmasterdetail
Dataview Dvw Dvwfilteredproducts

2 winform control naming rules

Data Type Abbreviated Data Type Standard naming example
Label LBL Lblmessage
Linklabel Llbl Llbltoday
Button BTN Btnsave
Textbox Txt Txtname
Mainmenu Mmnu Mmnufile
Checkbox Chk Chkstock
Radiobutton Rbtn Rbtnselected
Groupbox Gbx Gbxmain
Picturebox PIC Picimage
Panel Pnl Pnlbody
DataGrid Dgrd Dgrdview
ListBox LST Lstproducts
Checkedlistbox Clst Clstchecked
ComboBox CBO Cbomenu
Listview LVW Lvwbrowser
Treeview TVW Tvwtype
Tabcontrol Tctl Tctlselected
Datetimepicker DTP Dtpstartdate
Hscrollbar HSB Hsbimage
Vscrollbar VSB Vsbimage
Timer TMr Tmrcount
Imagelist Ilst Ilstimage
Toolbar TLB Tlbmanage
Statusbar STB Stbfootprint
Openfiledialog Odlg Odlgfile
Savefiledialog Sdlg Sdlgsave
Foldbrowserdialog Fbdlg Fgdlgbrowser
Fontdialog Fdlg Fdlgfoot
Colordialog Cdlg Cdlgcolor
Printdialog Pdlg Pdluplint

3. webcontrol naming rules

Data Type Abbreviated Data Type Standard naming example
Adrotator Adrt Example
Button BTN Btnsubmit
Calendar Cal Calmettingdates
Checkbox Chk Chkblue
Checkboxlist Chkl Chklkavcolors
Comparevalidator Valc Valcvalidage
Customvalidator Valx Valxdbcheck
DataGrid Dgrd Dgrdtitles
Datalist Dlst Dlsttitles
Dropdownlist Drop Dropcountries
Hyperlink Lnk Lnkdetails
Image IMG Imgauntbetty
Imagebutton Ibtn Ibtnsubmit
Label LBL Lblresults
Linkbutton Lbtn Lbtnsubmit
ListBox LST Lstcountries
Panel Pnl Pnlform2
Placeholder Plh Plhformcontents
Radiobutton Rad Radfemale
Radiobuttonlist Radl Radlgender
Rangevalidator Valg Valgage
Regularexpression Vale Valeemail_validator
Repeater RPT Rptqueryresults
Requiredfieldvalidator Valr Valrfirstname
Table TBL Tblcountrycodes
Tablecell Tblc Tblcgermany
Tablerow Tblr Tblrcountry
Textbox Txt Txtfirstname
Validationsummary Vals Valsformerrors
XML Xmlc Xmlctransformresults

Array arr arrshoppinglist
Boolean bln blnispostback
Byte BYT bytpixelvalue
Char CHR chrdelimiter
Datetime DTM dtmstartdate
Decimal dec decaverageheight
Double DBL dblsizeofuniverse
Integer int introwcounter
Long LNG lngbillgatesincome
Object OBJ objreturnvalue
Short SHR shraverage
Single Sng sngmaximum
String STR strfirstname

II,

Sqlserver naming rules

Sqlserver naming rules

For more information, see naming conventions:

If an existing abbreviation exists in the naming process, it is used. If not, it cannot be abbreviated, for example, ISBN.

Database: It is composed of one or three English words, with uppercase letters, for example, departmentmanage;

Table Name: It is represented by full spelling of nouns. the first letter of each word is capitalized and the plural form is used, for example, books.
If the table is used to indicate the relationship between fields in the other two tables, use the singular (that is, the table indicating the relationship between entities is named after the singular), and there is no prefix such as "and of in" in between words.
For example: bookauthor

========================================================== ========================================================== ====================
 
1. Fields in the table are generally represented by full spelling of nouns, consisting of one or three or less English words. The first letter of the word is capitalized, for example, username;

2. The table primary key name is: Table name + id, for example, the document table primary key name: entid

3. Foreign key name bit: main table name + corresponding column name, for example, departmentsid, which is described as follows:
In the table orders, the fields are: ID, departmentname
In the userinfo table, the fields are: userid, username, and departmentsid. departmentsid is a foreign key.

4. All automatically increasing columns in the table are named "ID;

5. If the field is of the bool type, it is expressed in the form of "isshow", "isvalid", "haspassed", "hasexamined", "ignorecase"

6. If the field is of the datetime type and the default value is system time, all fields are named: checkdate.

7. Status is the name of the table's state column. The default value is 0. Deleting a table changes the status value and does not actually Delete the record;

8. Stored Procedure name: SP _ TABLE name_method, for example, sp_news_add and sp_news_update;

9. View name: vi _ table name, for example, vi_news;

10. All objects such as tables, stored procedures, and views are DBO. Do not use the database username, which will affect changes to database users.

 

Related Article

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.