Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

C#Á¬½ÓAccessºÍSQL ServerÊý¾Ý¿â

C#Á¬½ÓÁ¬½Ó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".
note:
¡¡1."+="ºóÃæµÄ"@"·ûºÅÊÇ·ÀÖ¹½«ºóÃæ×Ö·û´®ÖеÄ"\"½âÎöΪתÒå×Ö·û.
¡¡2.Èç¹ûÒªÁ¬½ÓµÄÊý¾Ý¿âÎļþºÍµ±Ç°ÎļþÔÚͬһ¸öĿ¼ÏÂ,»¹¿ÉÒÔʹÓÃÈçϵķ½·¨Á¬½Ó:
¡¡¡¡strConnection+="Data Source=";
¡¡¡¡strConnection+=MapPath("Northwind.mdb");
¡¡¡¡ÕâÑù¾Í¿ÉÒÔÊ¡µÃÄãдһ´ó¶Ñ¶«Î÷ÁË!
¡¡3.ҪעÒâÁ¬½Ó×Ö·û´®ÖеIJÎÊýÖ®¼äÒªÓ÷ֺÅÀ´·Ö¸ô.
¡¡"OleDbConnection objConnection=new OleDbConnection(strConnection);"ÕâÒ»¾äÊÇÀûÓö¨ÒåºÃµÄÁ¬½Ó×Ö·û´®À´½¨Á¢ÁËÒ»¸öÁ´½Ó¶ÔÏó,ÒÔºó
¶ÔÊý¾Ý¿âµÄ²Ù×÷ÎÒÃǶ¼ÒªºÍÕâ¸ö¶ÔÏó´ò½»µÀ.
¡¡"objConnection.Open();"ÕâÓÃÀ´´ò¿ªÁ¬½Ó.ÖÁ´Ë,ÓëAccessÊý¾Ý¿âµÄÁ¬½ÓÍê³É.ÆäÓà²Ù×÷(²åÈë,ɾ³ý...)Çë²ÎÔÄÏà¹ØÊé¼®
C#Á¬½ÓSQL Server
Àý×Ó´úÂëƬ¶Ï:
³ÌÐò´úÂë:
--------------------------------------------------------------------------------
using System.Data;
using System.Data.SqlClient;
string strConnection = "server=localhost;database=Northwind;uid=sa;pwd=sa";
SqlConnection objConnection=new SqlConnection(strConnection);
...
objConnection.Open();
objConnection.Close();
...
--------------------------------------------


Ïà¹ØÎĵµ£º

SQL Server 2005 ¾µÏñ¹¹½¨ÊÖ²á

Ò»¡¢ ¾µÏñ¼ò½é
1¡¢ ¼ò½é
Êý¾Ý¿â¾µÏñÊǽ«Êý¾Ý¿âÊÂÎñ´¦Àí´ÓÒ»¸öSQL ServerÊý¾Ý¿âÒƶ¯µ½²»Í¬SQL Server»·¾³ÖеÄÁíÒ»¸öSQL ServerÊý¾Ý¿âÖС£¾µÏñ²»ÄÜÖ±½Ó·ÃÎÊ;ËüÖ»ÓÃÔÚ´íÎó»Ö¸´µÄÇé¿öϲſÉÒÔ±»·ÃÎÊ¡£
Òª½øÐÐÊý¾Ý¿â¾µÏñËùÐèµÄ×îСÐèÇó°üÀ¨ÁËÁ½¸ö²»Í¬µÄSQL ServerÔËÐл·¾³¡£Ö÷·þÎñÆ÷±»³ÆΪ“Ö÷»ú”£¬µÚ¶þ¸ö·þÎñÆ÷±» ......

C#Êý¾Ý¿âÁ¬½Ó×Ö·û´®——Oracle


ODBC DSN
ODBC -- New Microsoft Driver
ODBC -- Old Microsoft Driver
ODBC -- Oracle Driver
OleDb -- Microsoft Driver
OleDb -- Oracle Driver -- Standard Connection
OleDb -- Oracle Driver -- Trusted Connection
.NET DataProvider from Microsoft -- Standard Connection
.NET DataProvider fr ......

PowerDesignerÉú³ÉsqlºÍ·´Ïò¹¤³ÌÉú³ÉERͼµÄÎÊÌâ

PowerDesignerÉú³ÉsqlºÍ·´Ïò¹¤³ÌÉú³ÉERͼµÄÎÊÌâ
Ò»¡¢PowerDesignerÉú³ÉsqlÎÊÌâ
Éú³ÉsqlµÄ·½·¨ÊÇ Database -->Generate Database (Ctrl + G ) µ«ÊÇÌáʾ
Could not load VBScript engine.
Check VBScript installation.
Generation aborted due to errors detected during the verification of the model.
¼ì²éÁ˺à ......

ʹÓÃSQLÓï¾ä´´½¨Êý¾Ý¿â


ʹÓÃSQLÓï¾ä´´½¨Êý¾Ý¿â
±¾ÎÄת×Ô£ºhttp://www.cppblog.com/twzheng/archive/2008/07/07/55508.html
      ÓÃCREATE DATABASE´´½¨Êý¾Ý¿âµÄÓï·¨¸ñʽ£º
      CREATE DATABASE database_name   /*Ö¸¶¨Êý¾Ý¿âÃû*/
      [ON× ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ