ÓÃASP.NET/C#Á¬½ÓAccessºÍSQL ServerÊý¾Ý¿â
Á¬½ÓAccess
Ê×ÏÈ¿´Ò»¸öÀý×Ó´úÂëƬ¶Ï:
³ÌÐò´úÂë:
--------------------------------------------------------------------------------
using System.Data;
using System.Data.OleDb;
......
string strConnection="Provider=Microsoft.Jet.OleDb.4.0;";
strConnection+=@"Data Source=C:\BegASPNET\Northwind.mdb";
OleDbConnection objConnection=new OleDbConnection(strConnection);
......
objConnection.Open();
objConnection.Close();
......
--------------------------------------------------------------------------------
½âÊÍ:
¡¡Á¬½ÓAccessÊý¾Ý¿âÐèÒªµ¼Èë¶îÍâµÄÃüÃû¿Õ¼ä,ËùÒÔÓÐÁË×îÇ°ÃæµÄÁ½ÌõusingÃüÁî,ÕâÊDZز»¿ÉÉÙµÄ!
¡¡strConnectionÕâ¸ö±äÁ¿Àï´æ·ÅµÄÊÇÁ¬½ÓÊý¾Ý¿âËùÐèÒªµÄÁ¬½Ó×Ö·û´®,ËûÖ¸¶¨ÁËҪʹÓõÄÊý¾ÝÌṩÕߺÍҪʹÓõÄÊý¾ÝÔ´.
¡¡"Provider=Microsoft.Jet.OleDb.4.0;"ÊÇÖ¸Êý¾ÝÌṩÕß,ÕâÀïʹÓõÄÊÇMicrosoft JetÒýÇæ,Ò²¾ÍÊÇAccessÖеÄÊý¾ÝÒýÇæ,asp.net¾ÍÊÇ¿¿Õâ¸öºÍAccessµÄÊý¾Ý¿âÁ¬½ÓµÄ.
¡¡"Data Source=C:\BegASPNET\Northwind.mdb"ÊÇÖ¸Ã÷Êý¾ÝÔ´µÄλÖÃ,ËûµÄ±ê×¼ÐÎʽÊÇ"Data Source=MyDrive:MyPath\MyFile.MDB".
ps:
¡¡1."+="ºóÃæµÄ"@"·ûºÅÊÇ·ÀÖ¹½«ºóÃæ×Ö·û´®ÖеÄ"\"½âÎöΪתÒå×Ö·û.
¡¡2.Èç¹ûÒªÁ¬½ÓµÄÊý¾Ý¿âÎļþºÍµ±Ç°ÎļþÔÚͬһ¸öĿ¼ÏÂ,»¹¿ÉÒÔʹÓÃÈçϵķ½·¨Á¬½Ó:
¡¡¡¡strConnection+="Data Source=";
¡¡¡¡strConnection+=MapPath("Northwind.mdb");
¡¡¡¡ÕâÑù¾Í¿ÉÒÔÊ¡µÃÄãдһ´ó¶Ñ¶«Î÷ÁË!
¡¡3.ҪעÒâÁ¬½Ó×Ö·û´®ÖеIJÎÊýÖ®¼äÒªÓ÷ֺÅÀ´·Ö¸ô.
¡¡"OleDbConnection objConnection=new OleDbConnection(strConnection);"ÕâÒ»¾äÊÇÀûÓö¨ÒåºÃµÄÁ¬½Ó×Ö·û´®À´½¨Á¢ÁËÒ»¸öÁ´½Ó¶ÔÏó,ÒÔºó¶ÔÊý¾Ý¿âµÄ²Ù×÷ÎÒÃǶ¼ÒªºÍÕâ¸ö¶ÔÏó´ò½»µÀ.
¡¡"objConnection.Open();"ÕâÓÃÀ´´ò¿ªÁ¬½Ó.ÖÁ´Ë,ÓëAccessÊý¾Ý¿âµÄÁ¬½ÓÍê³É.ÆäÓà²Ù×÷(²åÈë,ɾ³ý...)Çë²ÎÔÄÏà¹ØÊé¼®
Á¬½ÓSQL Server
Àý×Ó´úÂëƬ¶Ï:
³ÌÐò´úÂë:
--------------------------------------------------------------------------------
using System.Data;
using System.Data.SqlClient;
...
string strConnection="user id=sa;password=;";
strConnection+="initial catalog=Northwind;Server=YourSQLServer;";
strConnection+="Connect Timeout=30";
SqlConnection objConnection=new SqlConnection(strConnection);
...
objConnection.Open();
objConn
Ïà¹ØÎĵµ£º
ϵͳ»·¾³£ºWindows 7
Èí¼þ»·¾³£ºVisual C++ 2008 SP1 +SQL Server 2005
±¾´ÎÄ¿µÄ£º±àдһ¸öº½¿Õ¹ÜÀíϵͳ
ÕâÊÇÊý¾Ý¿â¿Î³ÌÉè¼ÆµÄ³É¹û£¬ËäÈ»³É¼¨²»¼Ñ£¬µ«ÊÇ×÷ΪÎÒÓÃVC++ ÒÔÀ´±àдµÄ×î´ó³ÌÐò»¹ÊÇ´«µ½ÍøÉÏ£¬ÒÔ¹©²Î¿¼¡£ÓÃVC++ ×öÊý¾Ý¿âÉè¼Æ²¢²»ÈÝÒ×£¬µ«Ò²²»ÊDz»¿ÉÄÜ¡£ÒÔÏÂÊÇÎҵijÌÐò½çÃ棬ºóÃæ ......
ASP.NET Ajax Videoѧϰ±Ê¼Ç
5. Make Client-Side Network Callbacks with ASP.NET AJAX?
Notes:
ÔÚ<ScriptManager>ÖÐÌí¼Ó<Services>
4. Implement Dynamic Partial-Page Updates with ASP.NET AJAX?
Notes:
UpdatePanel¿ÉÒÔÍê³É²¿·ÖÒ³ÃæµÄ¸üÐÂ
Èç¹ûButtonÔÚUpdatePanelÖУ¬¼´Ê¹ÔÚPageLoad()Öаüº¬¸üÐÂË ......
SQL¿Í»§¶ËÊÇÿ¸ö¿ª·¢ÈËÔ±ËùÐèµÄ±Ø²»¿ÉÉٵŤ¾ß¡£ËûÃÇ°ïÖú¿ª·¢ÈËÔ±ÇáËɵØÔÚÈκÎÊý¾Ý¿âÖ´ÐÐSQL²éѯ¡£ËüÃǶÔÓÚ½â¾öÈκÎÊý¾Ý¿âÏà¹ØµÄÎÊÌâÒ²ÊǷdz£ÖØÒªµÄ¡£
1. SQuirreL SQL Client
SQuirreL SQL ClientÊÇÄ¿Ç°×îÁ÷ÐеĿªÔ´SQL¿Í»§¶Ë¡£ ......
......
ASP.NETÌṩÁË׿ԽµÄʼþÇý¶¯±à³ÌÄ£ÐÍ£¬Èÿª·¢Õß¼ò»¯ÁËÓ¦ÓóÌÐòµÄ×ÜÌåÉè¼Æ£¬µ«ÊÇÕâ¸öÒ²Ôì³ÉÁËËü¹ÌÓеÄһЩÎÊÌ⣬ÀýÈ磬ʹÓô«Í³µÄASPÀÎÒÃÇ¿ÉÒÔͨ¹ýʹÓÃPOST·½·¨ºÜÈÝÒ×µØʵÏÖÒ³Ãæ¼ä´«µÝÖµ£¬Í¬ÑùµÄÊÂÇ飬ÔÚʹÓÃʼþÇý¶¯±à³ÌÄ£Ð͵ÄASP.NET¾Í²»ÊÇÄÇôÈÝÒ×ÁË£¬µ±È»ÁË£¬ÎÒÃÇÈÔÈ»ÓÐһЩ·½·¨¿ÉÒÔʵÏÖͬÑùµÄ¹¦ÄÜ¡£±¾ÎĽ«ÊÔ×ÅʹÓò ......