½« Session ·ÅÈë SQLServer ±£´æ
SQLServer ģʽ¾ÍÊÇ£¬°ÑSession ´æ·ÅÔÚ SQL Server Êý¾Ý¿âÀעÒâ²»ÊÇ Oracle £¬¶¯¶¯½ÅÖº¶¼Äܲµ½ÔÒòÀ²£©£¬ÏÂÃ濪ʼ˵Ã÷Ò»ÏÂÉèÖõľßÌå²½Ö裺
1¡¢ Æô¶¯Ïà¹ØµÄÊý¾Ý¿â·þÎñ£¨Èçͼ£©
ÔËÐÐSQL Server ·þÎñ¹ÜÀíÆ÷ → Æô¶¯ SQL Server £¨×îºÃÉèΪ¿ª»ú×Ô¶¯ÔËÐУ© → Æô¶¯ SQL Server Agent ·þÎñ£¨×îºÃÉèΪ¿ª»ú×Ô¶¯ÔËÐУ©
×¢ÒâÊÂÏ
a)¡¢×¢ÒâÆô¶¯Ë³Ðò£¬Ò²¿Éͨ¹ýÏÂÁз½Ê½ÉèÖ㺠ÓÒ¼üµã»÷“ÎҵĵçÄÔ”→ ¹ÜÀí → ·þÎñÓëÓ¦ÓóÌÐò → ·þÎñ → ÕÒµ½“MSSQLSERVER”Óë“SQLSERVERAGENT” → Æô¶¯²¢ÉèÖÃÆô¶¯ÀàÐÍΪ“×Ô¶¯”
b)¡¢SQL Server AgentÔÚ´Ë´¦µÄ×÷ÓÃÊÇÇå³ýÊý¾Ý¿âÖÐÒѹýÆÚµÄ Session
2¡¢ ½¨Á¢´æ·Å Session µÄ DataBase
ÔËÐГSQL ²éѯ·ÖÎöÆ÷”→ ʹÓÓsa”»òÊÇÓµÓГmaster”µÄ db_owner ȨÏÞµÄÓû§µÇ¼Êý¾Ý¿â → ´ò¿ª²éѯÎļþ C:\WINNT\Microsoft.NET\Framework\v1.1.4322\InstallSqlState.sql £¨´æ·ÅÔÚ Windows ϵͳĿ¼µÄ .Net °²×°Ä¿Â¼Ï¿ÉÕÒµ½£© → Ö±½ÓÔËÐиà sql ½Å±¾ → Ë¢ÐÂÊý¾Ý¿â¼´¿É¿´µ½ÃûΪ ASPState µÄ DataBase
3¡¢ ½¨Á¢Á¬½ÓÊý¾Ý¿â ASPState µÄÓû§£¬²¢Îª´ËÓû§ÊÚȨ£¨´Ë²½Öè¿ÉÌø¹ý£©
½øÐд˲½µÄÔÒòÊÇ£ºÒ»ÊDz»ÏëÔÚ Web.config ÖгöÏÖ sa µÄÃÜÂ룻¶þÊÇ tempdb ÔÚÊý¾Ý¿âÆô¶¯ºó½ö±£Áô sa Ò»¸öÕʺŵÄʹÓÃȨÏÞ£¬ÆäÓàÕʺŵÄȨÏÞͳͳ±»Çå³ý£¬µ«±£´æ SessionÓÖÐèÒªÓõ½´Ë DataBase£»
A)¡¢ÔËÐÐ SQL Server µÄÆóÒµ¹ÜÀíÆ÷ → Õ¹¿ªÊý¾Ý¿âµÄ°²È«ÐÔ → ÓÒ»÷“µÇ¼” → н¨“µÇ¼” → ÊäÈë“Ãû³Æ” → Ñ¡Ôñ “SQL Server Éí·ÝÑéÖ¤” → ÊäÈë“ÃÜÂë” → Ö¸¶¨“Êý¾Ý¿â” → µã»÷“Êý¾Ý¿â·ÃÎÊ” → ¹´Ñ¡ “ASPState” → Ñ¡ÖГdb_owner”½ÇÉ« → µã»÷“È·¶¨” → ÔÙÒ»´ÎÊäÈë“ÃÜÂë” → µã»÷“È·¶¨” ºó¼´¿É½¨Á¢ ASPState µÄÓû§£¨´Ë´¦½¨Á¢ÃûΪ“SessionStateUser”£¬ÃÜÂëΪ“123456”µÄ²âÊÔÓû§£©
B)¡¢ÔËÐÐ SQL Server µÄÆóÒµ¹ÜÀíÆ÷ → Õ¹¿ª“¹ÜÀí” → Õ¹¿ª“SQ
Ïà¹ØÎĵµ£º
Óû§È¨ÏÞ¹ÜÀí
Ò»¡¢·þÎñÆ÷µÇ¼ÕʺźÍÓû§ÕʺŹÜÀí
1.SQL Server·þÎñÆ÷µÇ¼¹ÜÀí
²»¹ÜʹÓÃÄÄÖÖÈÏ֤ģʽ£¬Óû§¶¼±ØÐëÏȾ߱¸ÓÐЧµÄÓû§µÇ¼Õʺš£SQL ServerÓÐÈý¸öĬÈϵÄÓû§µÇ¼Õʺţº¼´sa¡¢Builtin\administratorsºÍguest¡£saÊÇϵͳ¹ÜÀíÔ±(system administrator)µÄ¼ò³Æ£¬ÊÇÒ»¸öÌØÊâµÄÓû§£¬ÔÚSQL ServerϵͳºÍËùÓÐÊý¾Ý¿âÖÐÓ ......
½ñÌìÔÚÍøÉÏÕÒÁËÐí¾Ã¹ØÓÚsqlserverÖд洢imageÀàÐͺͶÁÈ¡imageµÄ·½·¨£¬¿ÉÊǶ¼ÊÇÄÇôһµã£¬¹ÊÔÚ´ËÂÞÁÐһϣ¬Ï£Íû¿ÉÒÔ°ïÖú´ó¼Ò¡£
Ê×ÏÈÊǹØÓÚdataGridViewµÄ°ó¶¨¡£´úÂë¼ûÏÂ
private void button_show_Click(object sender, EventArgs e)
{
string sqlText = "server=localhost;initial catalog=Test; ......
±¾ÎÄת×Ô£ºhttp://blog.csdn.net/jinjazz/archive/2008/07/14/2650506.aspx
½«oledb¶ÁÈ¡µÄexcelÊý¾Ý¿ìËÙ²åÈëµÄsqlserverÖУ¬ºÜ¶àÈËͨ¹ýÑ»·À´Æ´½Ósql£¬ÕâÑù×ö²»µ«ÈÝÒ׳ö´í¶øÇÒЧÂʵÍÏ£¬×îºÃµÄ°ì·¨ÊÇʹÓÃbcp£¬Ò²¾ÍÊÇSystem.Data.SqlClient.SqlBulkCopy ÀàÀ´ÊµÏÖ¡£²»µ«Ëٶȿ죬¶øÇÒ´úÂë¼òµ¥£¬ÏÂÃæ²âÊÔ´ú ......
ÓÐЩ³£¼ûµÄÎÊÌâÔÚÂÛ̳Öв»¶Ï³öÏÖ£¬²»·ÁÕûÀíһϡ£
ÒÔÏÂÓï¾äÊÇÔÚSQLServer2005ÉÏʵÏֵģ¬Ò»Ð©Óï¾äÎÞ·¨ÔÚSS2000ÉÏÖ´ÐС£
ÓÐÓÃÖ¸ÊýÊÇÎÒ¸ù¾ÝÕâ¸öÎÊÌâµÄ³£¼û³Ì¶È´òµÄ·Ö£¬½ö¹©²Î¿¼¡£Êµ¼ÊÉÏ£¬µ±ÄãÓöµ½ÁËÕâ¸öÎÊÌ⣬Õâ¸öÎÊÌâÄÄÅÂÔÙÉÙ¼û£¬½â¾ö·½°¸Ò²ÊǷdz£ÓÐÓõġ£
1. Éú³ÉÈô¸ÉÐмǼ
ÓÐÓÃÖ¸Êý£º¡ï¡ï¡ï¡ï¡ï
³£¼ûµÄÎÊÌâÀàÐÍ£º¸ù¾Ý ......
µ±ÔÚC#ÓïÑÔÖУ¬Á¬½ÓsqlÊý¾Ý¿âµÄʱºò£¬³£Óõ½sqlconnection½¨Á¢ÓëÊý¾Ý¿âµÄÁ¬½Ó¡£ Óï·¨ÈçÏ£º
String sqlcon = "***";//ÕâÀïÊÇÒ»¸ö×Ö·û´®£¬¾ßÌå¸úÊý¾Ý¿âµÄÑéÖ¤·½Ê½Óйء£
//sql server Éí·ÝÑéÖ¤ Á¬½Ó×Ö·û´®
private string ConnstrSqlServer = "server=·þÎñÆ÷Ãû³ ......