C# Home / Ïê½âAsp.Net SqlÊý¾Ý¿âÁ¬½Ó×Ö·û´®
1.Á¬½ÓÊý¾Ý¿âÎļþ
<add name="LocalSqlServer" connectionString="Data Source=.\SQLExpress;Integrated Security=True;AttachDBFilename=|DataDirectory|TimeTracker.mdf;User Instance=true" />
SqlConnectionStringBuilderʵÀý»¯Ê±£¬ÒªÓõ½connectionString£¬È磺SqlConnectionStringBuild builder = new SqlConnectionStringBuild(connectionString)¡£
Ò»¡¢Data Source
SqlConnectionStringBuilderµÄDataSourceÊôÐÔ£¬¶ÔÓ¦connectionStringÖеÄData Source£¬“Data Source”¿ÉÒÔÓÉÏÂÁÐ×Ö·û´®´úÌ棺“server”£¬“address”£¬“addr”ºÍ“network address”¡£
Data Source=.\SQLExpressÒ²¿ÉÒÔд³ÉÕâÑùData Source=(local)\SQLExpress¡£
¶þ¡¢Integrated Security
SqlConnectionStringBuilderµÄIntegratedSecurityÊôÐÔ£¬¶ÔÓ¦connectionStringÖеÄIntegrated Security£¬“Integrated Security”¿ÉÒÔд³É“trusted_connection”£¬Îªtrueʱ£¬Ê¹Óõ±Ç°µÄ Windows ÕÊ»§Æ¾¾Ý½øÐÐÉí·ÝÑéÖ¤£¬Îªfalseʱ£¬ÐèÒªÔÚÁ¬½ÓÖÐÖ¸¶¨Óû§ ID ºÍÃÜÂë¡£
Èý¡¢AttachDBFilename
SqlConnectionStringBuilderµÄAttachDBFilenameÊôÐÔ£¬¶ÔÓ¦connectionStringÖеÄAttachDBFilename£¬“AttachDBFilename”¿ÉÒÔд³É“extended properties”£¬“initial file name”¡£AttachDbFileNameÊôÐÔÖ¸¶¨Á¬½Ó´ò¿ªµÄʱºò¶¯Ì¬¸½¼Óµ½·þÎñÆ÷ÉϵÄÊý¾Ý¿âÎļþµÄλÖá£Õâ¸öÊôÐÔ¿ÉÒÔ½ÓÊÜÊý¾Ý¿âµÄÍêÕû·¾¶ºÍÏà¶Ô·¾¶£¨ÀýÈçʹÓÃ|DataDirectory|Óï·¨£©£¬ÔÚÔËÐÐʱÕâ¸ö·¾¶»á±»Ó¦ÓóÌÐòµÄApp_DataĿ¼Ëù´úÌæ¡£
ÓÐһƪÎÄÕ£¬×¨ÃŽâÊÍDataDirectoryÊÇʲô¡£
ËÄ¡¢User Instance
SqlConnectionStringBuilderµÄUserInstanceÊôÐÔ£¬¶ÔÓ¦connectionStringÖеÄUser Instance ,¸ÃֵָʾÊÇ·ñ½«Á¬½Ó´ÓĬÈ쵀 SQL Server Express ʵÀýÖض¨Ïòµ½ÔÚµ÷Ó÷½ÕÊ»§Ö®ÏÂÔËÐв¢ÇÒÔÚÔËÐÐʱÆô¶¯µÄʵÀý¡£UserInstance=true£¬ÔÚÕâÖÖÇé¿öÏ£¬SQLServerExpressΪÁË°ÑÊý¾Ý¿â¸½¼Óµ½ÐµÄʵÀý£¬½¨Á¢Ò»¸öеĽø³Ì£¬ÔÚ´ò¿ªÁ¬½ÓµÄÓû§Éí·ÝÏÂÔËÐС£ÔÚASP.NETÓ¦ÓóÌÐòÖУ¬Õâ¸öÓû§ÊDZ¾µØµÄASPNETÕʺŻòĬÈϵÄNetworkService£¬ÕâÒÀÀµÓÚ²Ù×÷ϵͳ¡£ÎªÁË°²È«µØ¸½¼Ó·Çϵͳ¹ÜÀíÔ±Õʺţ¨ÀýÈçASP.NETÕʺţ©ÌṩµÄÊý¾Ý¿âÎļþ£¬½¨Á¢Ò»¸ö¶ÀÁ¢µÄSQLServerÓû§ÊµÀýÊDZØÒªµÄ¡£
¸½Â¼£
Ïà¹ØÎĵµ£º
Ô´Ìù£ºhttp://topic.csdn.net/u/20100417/19/ebdc216a-acc9-4e04-80f3-dbada0b4f3fe.html?74846
Êý¾ÝÀàÐÍ£º
Code char(6)
CreateTime datetime
Price float
Status bit
Êý¾ÝÈçÏ£º
Code CreateTime Price Status
031002 2008-10-17 ......
C# accessÈÕÆÚ²éѯ¼Ó#
if (((string)((ComboBoxItem)cmbField.SelectedItem).Value).Equals("System.DateTime"))
{
//ÅжÏÈÕÆÚµÄ;
& ......
//ÒÔÏÂÀ´×Ô:http://msdn.microsoft.com/zh-cn/library/sf985hc5.aspx
abstract£¨C# ²Î¿¼£©
¸üУº2007 Äê 11 ÔÂ
abstract ÐÞÊηû¿ÉÒÔºÍÀà¡¢·½·¨¡¢ÊôÐÔ¡¢Ë÷ÒýÆ÷¼°Ê¼þÒ»ÆðʹÓá£ÔÚÀàÉùÃ÷ÖÐʹÓà abstract ÐÞÊηûÒÔָʾij¸öÀàÖ»ÄÜÊÇÆäËûÀàµÄ»ùÀà¡£±ê¼ÇΪ³éÏó»ò°üº¬ÔÚ³éÏóÀàÖеijÉÔ±±ØÐëͨ¹ý´Ó³éÏóÀàÅÉÉúµÄÀàÀ´ÊµÏÖ¡£
ʾÀý ......
ÒÔÏ²ο¼ :http://msdn.microsoft.com/zh-cn/library/87d83y5b.aspx
½Ó¿Ú£¨C# ²Î¿¼£©
¸üУº2007 Äê 11 ÔÂ
½Ó¿ÚÖ»°üº¬·½·¨¡¢ÊôÐÔ¡¢Ê¼þ»òË÷ÒýÆ÷µÄÇ©Ãû¡£³ÉÔ±µÄʵÏÖÊÇÔÚʵÏÖ½Ó¿ÚµÄÀà»ò½á¹¹ÖÐÍê³ÉµÄ£¬ÈçÏÂÃæµÄʾÀýËùʾ£º
ʾÀý
interface ISampleInterface
{
void SampleMethod();
}
class Implem ......