C# SqlServer - .NET¼¼Êõ / C#
C# code:
SqlConnection myConn = new SqlConnection("Server=localhost;Database=Scores;uid=sa;pwd=;");
SqlCommand cmd= new SqlCommand();;
cmd.CommandType = System.Data.CommandType.Text;
myConn.Open();
cmd.CommandText = "insert into INFO(ѧºÅ) values ('111')";
int num = cmd.ExecuteNonQuery();
cmd.Connection = myConn;
ΪʲôûÓ𡣿´ó¼Ò°ï°ï棡Êý¾Ý¿âÖеıíû±ä°¡£¡
cmd.Connection = myConn;
·Åµ½µÚ3ÐÐÈ¥
ÒªÏÈΪSqlCommand¶ÔÏóÖ¸¶¨SqlConnectionÁ¬½Ó£¬È»ºóÔÙÖ´ÐÐÃüÁî¡£
¶÷ UP
ȷʵȷʵ£¬Ð»Ð»¶þ룬µ«ÊÇÎªÊ²Ã´ÄØ£¿
cmd.Connection = myConn; ·ÅÔÚ int num = cmd.ExecuteNonQuery(); Ç°ÃæÖ´ÐоÍOKÁË
SqlConnection myConn = new SqlConnection("Server=localhost;Database=Scores;uid=sa;pwd=;");
myConn.Open();
SqlCommand cmd= new SqlCommand('insert into INFO(ѧºÅ) values ('111')',myConn);
int num = cmd.ExecuteNonQuery();
myConn.Close();
1¡¢2Â¥¶¼ÕýÈ·
ÊÂʵÉϰÑcmd.Connection = myConn;
·Åµ½num = cmd.ExecuteNonQuery();֮ǰ¾ÍÐУ¬
cmdÒªÓÐÁ¬½Ó ²¢ÇÒÁ¬½Ó´ò¿ª²ÅÄÜexcute
Ïà¹ØÎÊ´ð£º
SHIFT¼ÓF10ÓëÄǸö¼üÓÒctrl±ßÉϵÄÄǸö¼ü¹¦ÄÜÒ»Ñù£¬ÏëÆÁÕâ¸ö
µ«²»ÖªÒªÔõôдÄǸö×éºÏ¼ü£¡
ÓÐûÄĸö´óÏÀ·ÅÒ»¶ÎÕâ¸öµÄ´úÂë»òдһ¶Î
http://topic.csdn.net/u/20090609/15/7dc9fb70-243f-4070-9cfd-34e48b66e6c6.html
......
¿ÉÄÜÒòΪ¹¤×÷µÄÔÒò ½Ó´¥Êý¾Ý¿âÕâ¿é±È½ÏÉÙ£¬Ö®Ç°¶¼ÊÇ×ö³ÌÐòÕâ¿é£¬Êý¾Ý¿âÕâ¿é¶¼ÓÐרÃŵÄÈËÀ´×ö ·Ö¹¤¶¼ºÜÃ÷ϸ ËùÒÔ¶ÔÊý¾Ý¿âÕâÒ»¿éÍêÈ«²»Á˽⡣ǰ¶Îʱ¼ä È¥ÃæÊÔÁ˼¸¼Ò¹«Ë¾ ¼¸ºõ¶¼ÊÇÔÚÊý¾Ý¿âÕâ¿é¹ÒµôµÄ Á¬¸ö¼òµ¥µÄSQ ......
´ó¼ÒºÃ£¬ÕâÊÇÒ»¸öÖ÷ÒªÃæÏòc/c++/mfcµÄȺ£¬×î½ü½øÐÐÁËÒ»´Î´óÇåÀí£¬»¶Ó¸÷λ¸ßÊÖ¼ÓÈ룬ºÃѧ°®ÎʵÄÐÂÊÖ£¬Ò²¿ÉÒÔÉêÇëµÄ£¬ÉêÇë¸ñʽ Ö°Òµ£¨c/c++/mfc ÈÎѡһ»òÕ߶ࣩ ¹¤×÷ÄêÏÞ£¨Ñ§ÉúÖ±½Óд´ó¼¸£©¾ÍÐÐÁË£¬ÈëȺµÄÒªÇó¾ÍÊÇÒª» ......