ÔÚasp.net 2.0ÖÐʹÓÃSqlBulkCopyÀàǨÒÆÊý¾Ý
ÎÒÃǾ³£ÒªÔÚÒ»¸ö±íÖн«Êý¾ÝǨÒƵ½ÁíÒ»¸ö±í£¬µ±È»£¬Óõķ½·¨Ê®·Ö¶àÁË¡£ÔÚ.net 2.0ÖУ¬ÌṩÁËÒ»¸ösqlbulkcopyÀ࣬Ҳ¿ÉÒÔʵÏÖÈçϵIJÙ×÷£¬ÏÂÃæ¼òµ¥½éÉÜÏ¡£±ÈÈçÒ»¸ö±íÈçÏÂ
CREATE TABLE Person3
(
PersonID int IDENTITY(1,1) PRIMARY KEY,
Name nvarchar(200),
Email nvarchar(200),
Picture image
)
INSERT INTO Person3(Name,Email,Picture)
SELECT Name,Email,Picture from Person
¼ÙÉèperson±íÒѾ´æÔÚÁË£¬ÔòÉÏÃæµÄÓï¾ä¿ÉÒÔÍùperson3±íÖвåÈëÊý¾Ý(ÔÚsql server 2005ÖÐÖ´ÐУ©¡£ÏÖÔÚÎÒÃÇʹÓÃÏÂÃæµÄ´úÂëÀ´ÊµÏÖ
string connectionString = ConfigurationManager.ConnectionStrings["MyDatabase"].ConnectionString;
SqlConnection myConnection = new SqlConnection(connectionString);
SqlCommand myCommand = new SqlCommand("SELECT * from Person", myConnection);
myConnection.Open();
SqlDataReader dr = myCommand.ExecuteReader();
SqlConnection myNewConnection = new SqlConnection(connectionString);
myNewConnection.Open();
SqlBulkCopy bulk = new SqlBulkCopy(myNewConnection);
bulk.DestinationTableName = "[Person3]";
try
{
bulk.WriteToServer(dr);
}
catch (Exception ex)
{
Response.Write(ex.Message);
}
finally
{
myNewConnection.Close();
dr.Close();
myConnection.Close();
bulk.Close();
}
ÏÂÃæÀ´½âÎöÏ¡£Ê×ÏÈ£¬Ð½¨Ò»¸öÊý¾Ý¿âÁ¬½Ó£¬Ö®ºóÊǺܾµäµÄ´úÂëÁË£¬´Óperson±íÖÐÄóöÊý¾Ý£¬µ±µ½datareaderÖÐÈ¥¡£Ö®ºó£¬ÎÒÃÇÓÖн¨Á¢Á˸öÊý¾ÝÁ¬½Ó£¬Ö®ºó£¬Ê¹ÓÃ
SqlBulkCopy bulk = new SqlBulkCopy(myNewConnection);
bulk.DestinationTableName = "[Person3]";
ÆäÖУ¬½«mynewconnection×÷Ϊ²ÎÊý´«µ½ sqlbulkcopyÀàµÄ¹¹Ôì²ÎÊýÖÐÈ¥£¬²¢Ö¸¶¨Ä¿±êǨÒƵıíÃûÊÇperson3.
Ö®ºó£¬ÔÙʹÓÃbulk.WriteToServer(dr);¾Í¿ÉÒÔǨÒÆÁË¡£
¶øÉÏÃæµÄperson±íºÍperson3µÄ½á¹¹ÊÇÍêÈ«ÏàͬµÄ£¬ÄÇôÈç¹û½á¹¹²»Í¬µÄ£¬Ôõô°ìÄØ£¿ÏÂÃæ¾ÙÀý×Ó˵Ã÷£¬´´½¨Ò»¸ö±íperson2
CREATE TABLE Person2
(
PersonID int IDENTITY(1,1) PRIMARY KEY,
FirstName nvarchar(200),
LastName nvarchar(200),
Email nvarchar(200),
Picture image
)
Èç¹ûÎÒÃÇ°´ÉÏÃ潫person±íǨÒƵ½person2±íÖÐÈ¥£¬½«»á³ö´í£¬ÒòΪ×ֶβ»Í¬£¬¶øÎÒÃǽ«²ÉÓÃÏÂÃæµÄ´úÂë
string conn
Ïà¹ØÎĵµ£º
1. ´Óhttp://sqlite.phxsoftware.com ÏÂÔØSystem.Data.SQLite.dll
2. ´Óhttp://www.sqlite.org/download.html ÏÂÔØ sqlite3.dll
3. Copy ÒÔÉÏ2¸öDllµ½Asp.netÍøÕ¾µÄbinĿ¼Ï£¬ÀàËÆ E:\2009work\MyWeb\Bin
4. ÓÃsqlitespy ¹¤¾ßн¨Êý¾Ý¿â£¬E:\2009work\MyWeb\App_Data\db.db3 £ ......
ÔÎÄ£ºÁõÎä|asp.netÖÐcookieµÄ´¦Àí
ʹÓÃÖз¢ÏÖÓÃRequest.Cookies.Remove()ÎÞ·¨É¾³ýcookie,googleÁËһϷ¢ÏÖÒ»°ãÊÇͨ¹ý½«¹ýÆÚʱ¼äÉèÖóɹýÈ¥µÄʱ¼äÀ´Íê³Éɾ³ýµÄ¡£Ë³±ãÕûÀíÏÂcookieµÄ²Ù×÷£º
Ò» ´´½¨
1 µ¥ÖµµÄ´´½¨
C#-Code:
HttpCookie hc = new HttpCookie("Value");
hc.Value = "value";
Response.Appe ......
string FormURL = "http://10.45.19.80:8080/easysendok.jsp";
//±íµ¥ÐèÒªÌá½»µÄ²ÎÊý
//sendobj ²ÎÊýΪ½ÓÊÕ¶ÔÏó£¨ÊÖ»úÓû§£©£»sendTextΪ¶ÌÐÅÄÚÈÝ
&n ......