Asp.NetÖÐsql server 2000/2005 Á¬½Ó×Ö·û´®
http://zhanglei1286.blog.163.com/blog/static/1895797120091112113019600/
ÔÚºǫ́´úÂëÀ
SQL 2000:
static string StrConn = "server=.;uid=sa;pwd=sa;database=MyCUDS";
SQL2005:
con = new SqlConnection(@"Server=.\SQLExpress;Database=db_CMS;Persist Security Info=True;User ID=sa;Password=Masslong");
ÔÚweb.configÀ
sql 2000:
<connectionStrings>
<add name="RateSystemConnectionString" connectionString="Data Source=.;Initial atalog=RateSystem;
User ID=sa Pwd=sa" providerName="System.Data.SqlClient" />
</connectionStrings>
sql 2005:
<connectionStrings>
<add name="BookShopConnectionString" connectionString="Data Source=.\SQLEXPRESS;
Initial Catalog=BookShop;Integrated Security=True" providerName="System.Data.SqlClient" />
</connectionStrings>
/////////////////////////////////////////////
<connectionStrings>
<add name="ConnectionString" providerName="System.Data.SqlClient" connectionString="Data Source=(local);Initial Catalog=dbname;User ID=sa;Password=1"/>
</connectionStrings>
DBHelper.cs»ñµÃ×Ö·û´®
string connectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
(*×¢£ºData Source¿ÉÒÔÓÃServer´úÌ棬Initial Catalog±íʾÊý¾Ý¿âÃû£¬¿ÉÒÔÓÃDatabase´úÌ棬(local)±íʾ±¾µØÁ¬½Ó£¬Èç¹ûÊÇÔ¶³ÌÁ¬½Ó£¬¿ÉÒÔÓÃÔ¶³ÌÖ÷»úÃû»òIPÀ´±íʾ)
<appSettings>
<add key="ConnectionString" value="Data Source=(local);Initial Catalog=dbname;User ID=sa;Password=1"/>
</appSettings>
<appSettings>
<add key="ConnectionString" value="server=192.168.1.1;database=shop;uid=sa;pwd=*"/>
</appSettings>
DBHelper.cs»ñµÃ×Ö·û´®
string connectionString =ConfigurationManager.AppSettings["ConnectionString"];
Ïà¹ØÎĵµ£º
±ÈÈçÏÖÔÚÓÐÒ»ÈËÔ±±í £¨±íÃû£ºpeosons£©
ÈôÏ뽫ÐÕÃû¡¢Éí·ÝÖ¤ºÅ¡¢×¡Ö·ÕâÈý¸ö×Ö¶ÎÍêÈ«ÏàͬµÄ¼Ç¼²éѯ³öÀ´
select p1.* from persons p1,persons p2 where p1.id<>p2.id and p1.cardid &nbs ......
Ò»°ãµÄÔ¶³Ì·ÃÎʵÄд³ÉÕâÑù£º
Data Source=IP;Initial Catalog=Êý¾Ý¿âÃû;UserID=Óû§Ãû;Password=ÃÜÂë
±¾µØ·ÃÎʵÄд³ÉÕâÑù£º
Data Source=(local);Initial Catalog=Êý¾Ý¿âÃû;UserID=Óû§Ãû;Password=ÃÜÂë
Èç¹ûÊDZ¾µØµÄ£¬Í¨¹ýwindows×é¼þÑéÖ¤µÄ£¨Ò²¾ÍÊÇûÓÐÓû§Ãû£¬ÃÜÂëµÄ£©Ð´³ÉÕâÑù£º
Data Source=(local);Initial Cata ......
Õý³£µÇ½sql*plusµÄ²½ÖèÈçÏ£º
sbdatabase*orcl-/home/oracle>sqlplus /nolog
SQL*Plus: Release 10.2.0.3.0 - Production on Sun May 9 19:50:24 2010
Copyright (c) 1982, 2006, Oracle. All Rights Reserved.
SQL> conn hmsimis/test@orcl
Connected.
SQL>
¿ÉÒÔ¿´µ½Ç°ÃæµÄÌáʾ·ûÊÇSQL£¬ÏÖÔÚÏëÐ ......
ASP.NETÏÂÔØ——word,txt,ͼƬ·½·¨
¡¡¡¡±¾ÎÄÖ÷Òª½éÉÜASP.NETÏÂÔØÖîÈçword,txt,ͼƬµÈµÄ·½·¨¡£
¡¡
¡¡ try
¡¡¡¡{
¡¡¡¡FullFileName = Server.MapPath(FileName); //FileName--ÒªÏÂÔصÄÎļþÃû
¡¡¡¡FileInfo DownloadFile= new FileInfo(FullFileName);
¡¡¡¡if(Down ......