linq to sql ÖдÓdbmlÎļþÖд´½¨Êý¾Ý¿â
½ñÌìºÜÓôÃÆ,ʵÑéÊҵķþÎñÆ÷¶«Î÷¶¼Ã»ÓÐÁË,¶øÎÒµÄÊý¾Ý¿âÓÖÔÚÄÄÀï,ÎÒÓÖûÓб¸·Ý,°ÑÎÒÒÖÓôµÄÒªÃü,ÐÒ¿÷ÎÒÓõÄlinq to sql.×ÐϸÏëÏë,ËûµÄdbmlÎļþ»ù±¾°üº¬ÁËÊý¾Ý¿âµÄËùÓÐÄÚÈÝ,ËùÒÔ,Ò»¶¨Óа취´ÓdbmlÎļþÖд´½¨Êý¾Ý¿â!
Ñо¿ÁËÒ»¶Îʱ¼ä,ÖÕÓÚÈÃÎÒÖؽ¨ÆðÁËÊý¾Ý¿â,ËäÈ»Êý¾Ý¶ªÁË,µ«ÄǶ¼ÊDzâÊÔÊý¾Ý,»ù±¾Ã»ÓÐʲôÓÃ.ºÇºÇÏÖÔÚ°ÑËüÃÇ·ÖÏí¸ø´ó¼Ò,ÁíÍâ˵һÉù,ǧÍò²»ÒªÍüÁ˱¸·ÝÊý¾Ý¿â°¡~~ѪµÄ½Ìѵ°¡! ¹Û²ìIDE×Ô¶¯Éú³ÉµÄdesigner.csÎļþ,²é¿´ÎļþµÄ½á¹¹ÈçÏÂ:
[Table(Name="dbo.tb_borrow")]
public partial class tb_borrow : INotifyPropertyChanging, INotifyPropertyChanged
{
private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
private System.Nullable<int> _bookId;
private System.Nullable<int> _userId;
[Column(Storage="_bookId", DbType="Int")]
public System.Nullable<int> bookId
{
get
{
return this._bookId;
}
set
{
if ((this._bookId != value))
{
this.OnbookIdChanging(value);
this.SendPropertyChanging();
this._bookId = value;
this.SendPropertyChanged("bookId");
this.OnbookIdChanged();
}
}
}
[Column(Storage="_userId", DbType="Int")]
public System.Nullable<int> userId
{
get
{
return this._userId;
}
set
{
if ((this._userId != value))
{
this.OnuserIdChanging(value);
this.SendPropertyChanging();
this._userId = value;
this.SendPropertyChanged("userId");
this.OnuserIdChanged();
}
}
}
}
(Ϊ½Úʡƪ·ùÕâÀïÖ»Áгö¼¸¸öÊôÐÔ)
¿ÉÒÔ·¢ÏÖ,ÿ¸öÀ඼ÊÇÓÉTableÊôÐÔÐÞÊεÄ,¶øÿ¸öÊôÐÔ¶¼ÊÇÓÉCulumnÐÞÊεÄ,¶øʵ¼ÊÉϸÃÊôÐÔ¶ÔÓ¦µÄÊÇColumnAttributeÀà,¸ÃÀà°üº¬ÁËÆäËù¶ÔÓ¦×ֶεÄ×Ö¶ÎÃûÒÔ¼°ÔÚÊý¾Ý¿âÖеÄ×Ö¶ÎÀàÐÍ,Å·À,Õâ¾ÍµÃÁË.ÎÒÃÇ´´½¨Êý¾Ý¿âºÍÊý¾Ý±íÓõľÍÊÇËüÀ².
½ÓÏÂÀ´Ö»ÒªÎÒÃDZàдÒÔÏ·½·¨±ä¿ÉÒÔÇáËÉʵÏÖÊý¾Ý±íµÄ»¹Ô:
private void reverseDataTable()
{//ÔÚÊý¾Ý¿âÖÐн¨Êý¾Ý±í
string
Ïà¹ØÎĵµ£º
Ö¢×´£º
SQL SERVER2005ÀïÃ棬Æô¶¯SQL´úÀí·þÎñ£¬Æô¶¯Õý³££¬µ«ÊÇÔÚsql server ´úÀí»¹ÊÇÏÔʾÒѽûÓôúÀí xp
ÔÚManagement StudioÖÐн¨Î¬»¤¼Æ»®Ê±£¬ÌáʾÒÔÏ´íÎóÐÅÏ¢£º
“´úÀíXP”×é¼þÒÑ×÷Ϊ´Ë·þÎñÆ÷°²È«ÅäÖõÄÒ»²¿·Ö±»¹Ø±Õ¡£ÏµÍ³¹ÜÀíÔ±¿ÉÒÔʹÓÃsp_configureÀ´ÆôÓÓ´úÀíXP”¡£ÓйØÆôÓÓ´úÀíXP ......
ÎÊÌâÃèÊö£ºÓÐÒÔÏÂ2ÕÅ±í£¬
±íA
0_id 0_name 0_Salary
Y2007001 ´ï¸ç &nbs ......
1¡¢¶¨ÒåÖ¸Á£ºusing System.Data.SqlClient;
2¡¢¶¨ÒåsqlÁ¬½Ó£º SqlConnection conn= new SqlConnection("server=(local);database=colorring;uid=sa;pwd=;");
3¡¢´ò¿ªsqlÁ¬½Ó£º conn.Open();
4¡¢¶¨ÒåsqlÓï¾ä£ºstring sqlstr = "insert into test values (123321)";
5¡¢×é×°sqlÓï¾äºÍÁ¬½Ó£ºSqlCommand cmd = new SqlCo ......
1.ÈçºÎ½«Ò»¸öSQL Server±íµÄ½á¹¹¸´ÖƵ½ÁíÒ»¸öн¨µÄ±íÖÐ
select * into бí from ¾É±í where 0 = 1
2.ÐÞ¸Ä×Ö¶ÎĬÈÏÖµ
alter table ±íÃû add default ĬÈÏÖµ for ×Ö¶ÎÃû
3. È¡µÃÊý¾Ý¿â½á¹¹
SELECT name from sysdatabases
4.Ôö¼ÓÁÐ
......
1. ¼òÊö private¡¢ protected¡¢ public¡¢ internal ÐÞÊηûµÄ·ÃÎÊȨÏÞ¡£
´ð . private : ˽ÓгÉÔ±, ÔÚÀàµÄÄÚ²¿²Å¿ÉÒÔ·ÃÎÊ¡£
protected : ±£»¤³ÉÔ±£¬¸ÃÀàÄÚ²¿ºÍ¼Ì³ÐÀàÖпÉÒÔ·ÃÎÊ¡£
public : ¹«¹²³ÉÔ±£¬ÍêÈ«¹«¿ª£¬Ã»ÓзÃÎÊÏÞÖÆ¡£
internal: ÔÚÍ¬Ò ......