锘??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲国产一区二区三区在线观看,亚洲乱码在线卡一卡二卡新区,国产亚洲精品va在线http://www.tkk7.com/keweibo/zh-cnThu, 27 Mar 2025 10:24:45 GMTThu, 27 Mar 2025 10:24:45 GMT60Sqoop&Hive錛岃В鍐矱RROR hive.HiveConfig: Could not load org.apache.hadoop.hive.conf.HiveConf. Make sure HIVE_CONF_DIR is set correctly. http://www.tkk7.com/keweibo/articles/433143.htmlKeKeTue, 03 Apr 2018 08:56:00 GMThttp://www.tkk7.com/keweibo/articles/433143.htmlhttp://www.tkk7.com/keweibo/comments/433143.htmlhttp://www.tkk7.com/keweibo/articles/433143.html#Feedback0http://www.tkk7.com/keweibo/comments/commentRss/433143.htmlhttp://www.tkk7.com/keweibo/services/trackbacks/433143.html鍦?$SQOOP_HOME/lib鐩綍涓嬫墽琛屼互涓嬪懡浠?br />
ln -s  /app/soft/apache-hive-2.3.2-bin/lib/hive-exec-2.3.2.jar   hive-exec-2.3.2.jar


Ke 2018-04-03 16:56 鍙戣〃璇勮
]]>
鏃墮棿鍒楄漿鍖?amp;&鍔ㄦ佹寚瀹氬垎鍖篒nsert鏁版嵁http://www.tkk7.com/keweibo/articles/433141.htmlKeKeMon, 02 Apr 2018 08:47:00 GMThttp://www.tkk7.com/keweibo/articles/433141.htmlhttp://www.tkk7.com/keweibo/comments/433141.htmlhttp://www.tkk7.com/keweibo/articles/433141.html#Feedback0http://www.tkk7.com/keweibo/comments/commentRss/433141.htmlhttp://www.tkk7.com/keweibo/services/trackbacks/433141.html--鐒跺悗鍐岻nsert琛紝鍔ㄦ佹寚瀹氬垎鍖?br />
insert overwrite table partition_user_table partition (dt) select id, account, name, create_time,  from_unixtime(unix_timestamp(create_time,'yyyy/mm/dd'),'yyyymmdd') as dt from external_user_table;


Ke 2018-04-02 16:47 鍙戣〃璇勮
]]>
hadoop鎴杊base闆嗙兢閲嶅惎澶辨晥鑺傜偣http://www.tkk7.com/keweibo/articles/433135.htmlKeKeFri, 30 Mar 2018 02:44:00 GMThttp://www.tkk7.com/keweibo/articles/433135.htmlhttp://www.tkk7.com/keweibo/comments/433135.htmlhttp://www.tkk7.com/keweibo/articles/433135.html#Feedback0http://www.tkk7.com/keweibo/comments/commentRss/433135.htmlhttp://www.tkk7.com/keweibo/services/trackbacks/433135.html鏈夋椂鍊檋adoop鎴杊base闆嗙兢榪愯鏃墮棿涔呬簡鍚庯紝鏌愪簺鑺傜偣灝變細(xì)澶辨晥錛岃繖涓椂鍊欏鏋滀笉鎯抽噸鍚暣涓泦緹わ紙榪欑鎯呭喌鍦ㄥ緢澶氭儏鍐典笅宸茬粡涓嶈鍏佽錛夛紝榪欎釜鏃跺欏彲浠ュ崟鐙噸鍚け鏁堣妭鐐廣?/span>
HADOOP錛?br style="box-sizing: border-box;" />
hadoop涓噸鍚崟鑺傜偣鐨勬柟娉曞拰澧炲姞鏂拌妭鐐瑰叾瀹炴槸涓鏍風(fēng)殑銆?/div>
閲嶅惎鎴栨坊鍔犺妭鐐?/strong>

$bin/hadoop-daemon.sh start datanode 
褰撶劧錛屾坊鍔犵殑璇濋渶瑕乧opy閰嶇疆鏂囦歡鍒版柊鑺傜偣銆傞噸鍚殑璇濆厛  $bin/hadoop-daemon.sh stop datanode

閲嶆柊balancer(鍙?
$bin/hadoop balancer
鍏跺疄闆嗙兢鑷繁浼?xì)balancer錛屽綋鐒朵篃鍙互鍍忎笂闈㈤偅鏍鋒墜鍔╞alancer錛屼笉鐒跺湪綣佸繖鏃舵鏈濂介伩鍏嶃?/span>

HBASE錛?/strong>
閲嶅惎
$bin/hbase-daemon.sh stop regionserver
$bin/hbase-daemon.sh start regionserver

涔熷彲浠ユ坊鍔犳柊鐨刴aster錛堥粯璁ゅ彧鏈変竴涓猰aster錛夛紝
$bin/hbase-daemon.sh start master


Ke 2018-03-30 10:44 鍙戣〃璇勮
]]>windows涓嬩嬌鐢↖DEA寮鍙?spark SQL渚嬪瓙鎶llegalArgumentException: java.net.URISyntaxException: Relative path in absolute URIhttp://www.tkk7.com/keweibo/articles/433116.htmlKeKeWed, 21 Mar 2018 03:31:00 GMThttp://www.tkk7.com/keweibo/articles/433116.htmlhttp://www.tkk7.com/keweibo/comments/433116.htmlhttp://www.tkk7.com/keweibo/articles/433116.html#Feedback0http://www.tkk7.com/keweibo/comments/commentRss/433116.htmlhttp://www.tkk7.com/keweibo/services/trackbacks/433116.html
public class FirstSparkSql {
public static void main(String[] args) {


String masterMode = "local";//spark://master:7077

SparkConf conf = new SparkConf();
//conf.set("spark.executor.memory", "1024m");
conf.setAppName("First Spark SQL");
conf.setMaster(masterMode);
//瑙e喅寮傚父錛?/span>IllegalArgumentException: java.net.URISyntaxException: Relative path in absolute URI
conf.set("spark.sql.warehouse.dir","D:\\temp_files");

JavaSparkContext sc = new JavaSparkContext(conf);

SparkSession spark = SparkSession.builder().config(conf).getOrCreate();
Dataset<Row> df = spark.read().json("hdfs://master:9000/user/spark/input/persons.txt");
df.show();
sc.stop();
}
}


Ke 2018-03-21 11:31 鍙戣〃璇勮
]]>
ORA-54033 瑕佷慨鏀圭殑鍒楃敱鏌愪釜铏氭嫙琛ㄨ揪寮忎嬌鐢?/title><link>http://www.tkk7.com/keweibo/articles/427353.html</link><dc:creator>Ke</dc:creator><author>Ke</author><pubDate>Wed, 16 Sep 2015 06:30:00 GMT</pubDate><guid>http://www.tkk7.com/keweibo/articles/427353.html</guid><wfw:comment>http://www.tkk7.com/keweibo/comments/427353.html</wfw:comment><comments>http://www.tkk7.com/keweibo/articles/427353.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/keweibo/comments/commentRss/427353.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/keweibo/services/trackbacks/427353.html</trackback:ping><description><![CDATA[<em style="text-transform: none; background-color: rgb(254,254,254); text-indent: 0px; font: 14px/21px 'Helvetica Neue', Helvetica, Tahoma, Arial, STXihei, 'Microsoft YaHei', 寰蔣闆呴粦, sans-serif; white-space: normal; float: left; letter-spacing: normal; color: rgb(153,153,153); word-spacing: 0px; -webkit-text-stroke-width: 0px">鍘熸枃</em><span style="text-transform: none; background-color: rgb(254,254,254); text-indent: 0px; display: inline !important; font: 14px/21px 'Helvetica Neue', Helvetica, Tahoma, Arial, STXihei, 'Microsoft YaHei', 寰蔣闆呴粦, sans-serif; white-space: normal; float: none; letter-spacing: normal; color: rgb(153,153,153); word-spacing: 0px; -webkit-text-stroke-width: 0px"> <span id="jzj7vxx" class="Apple-converted-space"> </span></span><a style="text-transform: none; background-color: rgb(254,254,254); text-indent: 0px; text-overflow: ellipsis; display: inline-block; font: 14px/21px 'Helvetica Neue', Helvetica, Tahoma, Arial, STXihei, 'Microsoft YaHei', 寰蔣闆呴粦, sans-serif; max-width: 69%; white-space: nowrap; letter-spacing: normal; color: rgb(51,51,51); overflow: hidden; word-spacing: 0px; text-decoration: none; -webkit-text-stroke-width: 0px; transition: 0.25s; -webkit-transition: 0.25s" class="cut cut70" >http://blogs.oracle.com/sql/entry/ora_54033_and_the_hidden</a><br /><br /> <p style="text-transform: none; background-color: rgb(254,254,254); text-indent: 1em; margin: 0px 0px 0.75em; font: 16px/27px 'Helvetica Neue', Helvetica, Tahoma, Arial, STXihei, 'Microsoft YaHei', 寰蔣闆呴粦, sans-serif; white-space: normal; letter-spacing: normal; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-stroke-width: 0px">A colleague recently asked me a question:</p> <address style="text-transform: none; background-color: rgb(254,254,254); text-indent: 0px; display: block; font: 16px/1.5em 'Helvetica Neue', Helvetica, Tahoma, Arial, STXihei, 'Microsoft YaHei', 寰蔣闆呴粦, sans-serif; white-space: normal; margin-bottom: 1.5em; letter-spacing: normal; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-stroke-width: 0px"> <p style="line-height: 1.7em; text-indent: 1em; margin: 0px 0px 0.75em; font-size: 16px">"I'm modifying the data type of a column. When doing so I get the following error:</p> <p style="line-height: 1.7em; text-indent: 1em; margin: 0px 0px 0.75em; font-size: 16px">ORA-54033: column to be modified is used in a virtual column expression</p> <p style="line-height: 1.7em; text-indent: 1em; margin: 0px 0px 0.75em; font-size: 16px">But there's no virtual columns defined on the table! What on earth's going on?!"</p></address> <p style="text-transform: none; background-color: rgb(254,254,254); text-indent: 1em; margin: 0px 0px 0.75em; font: 16px/27px 'Helvetica Neue', Helvetica, Tahoma, Arial, STXihei, 'Microsoft YaHei', 寰蔣闆呴粦, sans-serif; white-space: normal; letter-spacing: normal; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-stroke-width: 0px">This was exceptionally confusing. Looking at the table definition we couldn't see any virtual columns defined: </p><pre style="border-bottom: 1px solid; border-left: 1px solid; padding-bottom: 0.3em; overflow-y: auto; text-transform: none; background-color: rgb(246,246,246); text-indent: 0px; margin: 0px 0px 0.75em; padding-left: 0.3em; padding-right: 0.3em; display: block; font: 12px/1.5em Monaco, Menlo, Consolas, 'Courier New', monospace; word-wrap: break-word; white-space: pre-wrap; letter-spacing: normal; color: rgb(51,51,51); word-break: break-all; border-top: 1px solid; border-right: 1px solid; word-spacing: 0px; padding-top: 0.3em; -webkit-text-stroke-width: 0px; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px" class="sql"><span id="5zljz1b" class="operator"><span style="color: rgb(51,51,51); font-weight: bold" class="keyword">create</span> <span style="color: rgb(51,51,51); font-weight: bold" class="keyword">table</span> tab ( x <span style="color: rgb(51,51,51); font-weight: bold" class="keyword">integer</span>, y <span style="color: rgb(51,51,51); font-weight: bold" class="keyword">date</span>, z varchar2(<span style="color: rgb(0,153,153)" class="number">30</span>) );</span></pre> <p style="text-transform: none; background-color: rgb(254,254,254); text-indent: 1em; margin: 0px 0px 0.75em; font: 16px/27px 'Helvetica Neue', Helvetica, Tahoma, Arial, STXihei, 'Microsoft YaHei', 寰蔣闆呴粦, sans-serif; white-space: normal; letter-spacing: normal; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-stroke-width: 0px">Sure enough, when we tried to change the data type of y we got the exception:</p><pre style="border-bottom: 1px solid; border-left: 1px solid; padding-bottom: 0.3em; overflow-y: auto; text-transform: none; background-color: rgb(246,246,246); text-indent: 0px; margin: 0px 0px 1.5em; padding-left: 0.3em; padding-right: 0.3em; display: block; font: 12px/1.5em Monaco, Menlo, Consolas, 'Courier New', monospace; word-wrap: break-word; white-space: pre-wrap; letter-spacing: normal; color: rgb(51,51,51); word-break: break-all; border-top: 1px solid; border-right: 1px solid; word-spacing: 0px; padding-top: 0.3em; -webkit-text-stroke-width: 0px; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px" class="prettyprint sql"><span id="hbrnj91" class="operator"><span style="color: rgb(51,51,51); font-weight: bold" class="keyword">alter</span> <span style="color: rgb(51,51,51); font-weight: bold" class="keyword">table</span> tab modify (y <span style="color: rgb(51,51,51); font-weight: bold" class="keyword">timestamp</span>);</span> ORA-54033: column to be modified is used in a virtual column expression</pre> <p style="text-transform: none; background-color: rgb(254,254,254); text-indent: 1em; margin: 0px 0px 0.75em; font: 16px/27px 'Helvetica Neue', Helvetica, Tahoma, Arial, STXihei, 'Microsoft YaHei', 寰蔣闆呴粦, sans-serif; white-space: normal; letter-spacing: normal; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-stroke-width: 0px">How could this be? </p> <p style="text-transform: none; background-color: rgb(254,254,254); text-indent: 1em; margin: 0px 0px 0.75em; font: 16px/27px 'Helvetica Neue', Helvetica, Tahoma, Arial, STXihei, 'Microsoft YaHei', 寰蔣闆呴粦, sans-serif; white-space: normal; letter-spacing: normal; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-stroke-width: 0px">Perhaps there was a column defined that we couldn't see. Querying user_tab_cols revealed something interesting:</p><pre style="border-bottom: 1px solid; border-left: 1px solid; padding-bottom: 0.3em; overflow-y: auto; text-transform: none; background-color: rgb(246,246,246); text-indent: 0px; margin: 0px 0px 1.5em; padding-left: 0.3em; padding-right: 0.3em; display: block; font: 12px/1.5em Monaco, Menlo, Consolas, 'Courier New', monospace; word-wrap: break-word; white-space: pre-wrap; letter-spacing: normal; color: rgb(51,51,51); word-break: break-all; border-top: 1px solid; border-right: 1px solid; word-spacing: 0px; padding-top: 0.3em; -webkit-text-stroke-width: 0px; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px" class="prettyprint sql"><span id="b35xvjh" class="operator"><span style="color: rgb(51,51,51); font-weight: bold" class="keyword">select</span> column_name, data_default, hidden_column <span style="color: rgb(51,51,51); font-weight: bold" class="keyword">from</span> user_tab_cols <span style="color: rgb(51,51,51); font-weight: bold" class="keyword">where</span> table_name = <span style="color: rgb(221,17,68)" class="string">'TAB'</span>;</span> COLUMN_NAME <span style="white-space: pre"> </span>DATA_DEFAULT <span style="white-space: pre"> </span>HID <span style="font-style: italic; color: rgb(153,153,136)" class="comment">------------------------------ <span style="white-space: pre"> </span>----------------------------- ---</span> SYS_STUYPW88OE302TFVBNC6$MMQXE<span style="white-space: pre"> </span>SYS_OP_COMBINED_HASH("X","Y")<span style="white-space: pre"> </span>YES Z<span style="white-space: pre"> </span> NO Y<span style="white-space: pre"> </span>NO X<span style="white-space: pre"> </span>NO</pre> <p style="text-transform: none; background-color: rgb(254,254,254); text-indent: 1em; margin: 0px 0px 0.75em; font: 16px/27px 'Helvetica Neue', Helvetica, Tahoma, Arial, STXihei, 'Microsoft YaHei', 寰蔣闆呴粦, sans-serif; white-space: normal; letter-spacing: normal; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-stroke-width: 0px">The SYS_... column isn't in the table DDL! Where does it come from? And what's SYS_OP_COMBINED_HASH all about? Has someone been mucking around with the database?</p> <div style="text-transform: none; background-color: rgb(254,254,254); text-indent: 0px; font: 16px/27px 'Helvetica Neue', Helvetica, Tahoma, Arial, STXihei, 'Microsoft YaHei', 寰蔣闆呴粦, sans-serif; white-space: normal; letter-spacing: normal; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-stroke-width: 0px"> <p style="line-height: 1.7em; text-indent: 1em; margin: 0px 0px 0.75em; font-size: 16px">The SYS_ prefix is a sign that the column is system generated. So something's happened that's caused Oracle to create this on our behalf.</p> <p style="line-height: 1.7em; text-indent: 1em; margin: 0px 0px 0.75em; font-size: 16px">SYS_OP_COMBINED_HASH is an undocumented feature. The name implies Oracle is merging the arguments together to form a hash.</p> <p style="line-height: 1.7em; text-indent: 1em; margin: 0px 0px 0.75em; font-size: 16px">Is there a feature where we want to capture information about a group of columns?</p></div> <div style="text-transform: none; background-color: rgb(254,254,254); text-indent: 0px; font: 16px/27px 'Helvetica Neue', Helvetica, Tahoma, Arial, STXihei, 'Microsoft YaHei', 寰蔣闆呴粦, sans-serif; white-space: normal; letter-spacing: normal; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-stroke-width: 0px"> <p style="line-height: 1.7em; text-indent: 1em; margin: 0px 0px 0.75em; font-size: 16px">Indeed there is -extended statistics!This feature enables to Oracle calculate statistics on a group of columns. It uses this information to improve row estimates. This is useful when there's a correlation between the values of two (or more) columns in a table.</p> <p style="line-height: 1.7em; text-indent: 1em; margin: 0px 0px 0.75em; font-size: 16px">Someone had created extended stats on this table for (x, y).</p></div> <p style="text-transform: none; background-color: rgb(254,254,254); text-indent: 1em; margin: 0px 0px 0.75em; font: 16px/27px 'Helvetica Neue', Helvetica, Tahoma, Arial, STXihei, 'Microsoft YaHei', 寰蔣闆呴粦, sans-serif; white-space: normal; letter-spacing: normal; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-stroke-width: 0px">Now we've identified the problem, how do we get around it?</p> <p style="text-transform: none; background-color: rgb(254,254,254); text-indent: 1em; margin: 0px 0px 0.75em; font: 16px/27px 'Helvetica Neue', Helvetica, Tahoma, Arial, STXihei, 'Microsoft YaHei', 寰蔣闆呴粦, sans-serif; white-space: normal; letter-spacing: normal; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-stroke-width: 0px">Simple: drop and recreate the extended stats:</p><pre style="border-bottom: 1px solid; border-left: 1px solid; padding-bottom: 0.3em; overflow-y: auto; text-transform: none; background-color: rgb(246,246,246); text-indent: 0px; margin: 0px 0px 1.5em; padding-left: 0.3em; padding-right: 0.3em; display: block; font: 12px/1.5em Monaco, Menlo, Consolas, 'Courier New', monospace; word-wrap: break-word; white-space: pre-wrap; letter-spacing: normal; color: rgb(51,51,51); word-break: break-all; border-top: 1px solid; border-right: 1px solid; word-spacing: 0px; padding-top: 0.3em; -webkit-text-stroke-width: 0px; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px" class="prettyprint sql">exec dbms_stats.drop_extended_stats(user, 'tab', '(x, y)'); <span id="npnnbpx" class="operator"><span style="color: rgb(51,51,51); font-weight: bold" class="keyword">alter</span> <span style="color: rgb(51,51,51); font-weight: bold" class="keyword">table</span> tab modify (y <span style="color: rgb(51,51,51); font-weight: bold" class="keyword">timestamp</span>);</span> <span id="ffbltrh" class="operator"><span style="color: rgb(51,51,51); font-weight: bold" class="keyword">select</span> dbms_stats.create_extended_stats(<span style="color: rgb(51,51,51); font-weight: bold" class="keyword">user</span>, <span style="color: rgb(221,17,68)" class="string">'tab'</span>, <span style="color: rgb(221,17,68)" class="string">'(x, y)'</span>) <span style="color: rgb(51,51,51); font-weight: bold" class="keyword">from</span> dual;</span> DBMS_STATS.CREATE_EXTENDED_STATS(USER,'TAB','(X,Y)') <span style="font-style: italic; color: rgb(153,153,136)" class="comment">--------------------------------------------------------------------------------</span> SYS_STUYPW88OE302TFVBNC6$MMQXE </pre> <p style="text-transform: none; background-color: rgb(254,254,254); text-indent: 1em; margin: 0px 0px 0.75em; font: 16px/27px 'Helvetica Neue', Helvetica, Tahoma, Arial, STXihei, 'Microsoft YaHei', 寰蔣闆呴粦, sans-serif; white-space: normal; letter-spacing: normal; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-stroke-width: 0px">Success!</p> <p style="text-transform: none; background-color: rgb(254,254,254); text-indent: 1em; margin: 0px 0px 0.75em; font: 16px/27px 'Helvetica Neue', Helvetica, Tahoma, Arial, STXihei, 'Microsoft YaHei', 寰蔣闆呴粦, sans-serif; white-space: normal; letter-spacing: normal; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-stroke-width: 0px">Extended stats are a great way to improve the optimizer's row estimates. If you need to create these, I recommend you also do the following:</p> <div style="text-transform: none; background-color: rgb(254,254,254); text-indent: 0px; font: 16px/27px 'Helvetica Neue', Helvetica, Tahoma, Arial, STXihei, 'Microsoft YaHei', 寰蔣闆呴粦, sans-serif; white-space: normal; letter-spacing: normal; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-stroke-width: 0px"> <ul style="padding-bottom: 0px; line-height: 1.7em; list-style-type: none; margin: 0px 0px 0.75em 25px; padding-left: 0px; padding-right: 0px; font-size: 16px; padding-top: 0px"><li style="line-height: 1.7em; list-style-type: disc; font-size: 16px">Apply the extended stats to all environments</li><li style="line-height: 1.7em; list-style-type: disc; font-size: 16px">Put a comment on the columns explaining what you've done, e.g. </li> <ul style="padding-bottom: 0px; line-height: 1.7em; list-style-type: none; margin: 0px 0px 0px 25px; padding-left: 0px; padding-right: 0px; font-size: 16px; padding-top: 0px"><li style="line-height: 1.7em; list-style-type: disc; font-size: 16px">comment on column tab.x is 'part of extended stats. To modify data type drop and recreate stats';</li></ul></ul>These actions will help prevent future developers getting stuck tracking down the cause of "missing" virtual columns!</div><img src ="http://www.tkk7.com/keweibo/aggbug/427353.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/keweibo/" target="_blank">Ke</a> 2015-09-16 14:30 <a href="http://www.tkk7.com/keweibo/articles/427353.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>JQuery EasyUI combobox鍔ㄦ佹坊鍔爋ption(杞?http://www.tkk7.com/keweibo/articles/418124.htmlKeKeSat, 20 Sep 2014 07:59:00 GMThttp://www.tkk7.com/keweibo/articles/418124.htmlhttp://www.tkk7.com/keweibo/comments/418124.htmlhttp://www.tkk7.com/keweibo/articles/418124.html#Feedback0http://www.tkk7.com/keweibo/comments/commentRss/418124.htmlhttp://www.tkk7.com/keweibo/services/trackbacks/418124.html
<input class="easyui-combobox" id="rwlb" name="rwlb" style="width:435px" data-options="valueField:'id', textField:'text', panelHeight:'auto'" >  

鏂規(guī)硶涓錛?/p>

1 var data, json;
2 json = '[{"id":"騫磋鍒?,"text":"騫磋鍒?,"selected":true}]';
3 data = $.parseJSON(json);
4 $("#rwlb").combobox("loadData", data);

鏂規(guī)硶浜岋細(xì)

1 var data,json;
2 data = [];
3 data.push({ "text": "嫻嬭瘯", "id": 100 });
4 $("#rwlb").combobox("loadData", data);
杞嚜錛?a >http://www.cnblogs.com/easypass/archive/2012/12/29/2838329.html

Ke 2014-09-20 15:59 鍙戣〃璇勮
]]>
杞細(xì)Easyui Tree鏂規(guī)硶鎵╁睍 - getLevel(鑾峰彇鑺傜偣綰у埆)http://www.tkk7.com/keweibo/articles/417899.htmlKeKeSat, 13 Sep 2014 08:12:00 GMThttp://www.tkk7.com/keweibo/articles/417899.htmlhttp://www.tkk7.com/keweibo/comments/417899.htmlhttp://www.tkk7.com/keweibo/articles/417899.html#Feedback0http://www.tkk7.com/keweibo/comments/commentRss/417899.htmlhttp://www.tkk7.com/keweibo/services/trackbacks/417899.htmlhttp://www.jeasyuicn.com/the-extended---easyui-tree-method-getlevel-access-node-level.html


Easyui Tree涓鐩村氨娌℃湁鎻愪緵榪欎釜鏂規(guī)硶,浠ュ墠娌℃湁鐢ㄥ埌,鎵浠ヤ竴鐩存病鎬庝箞鍦ㄦ剰,榪欐鑷繁鐢ㄥ埌浜?欏轟究鎵╁睍浜嗕竴涓柟娉?鍒嗕韓緇欏ぇ瀹?

1 $.extend($.fn.tree.methods, {
2     getLevel:function(jq,target){
3         var l = $(target).parentsUntil("ul.tree","ul");
4         return l.length+1;
5     }
6 });
鐢ㄦ硶:
1 var node = $().tree("getSelected");
2 var lv =  $().tree("getLevel",node.target);


Ke 2014-09-13 16:12 鍙戣〃璇勮
]]>
oracle 鍗佽繘鍒朵笌鍗佸叚榪涘埗鐨勮漿鎹?/title><link>http://www.tkk7.com/keweibo/articles/416374.html</link><dc:creator>Ke</dc:creator><author>Ke</author><pubDate>Wed, 30 Jul 2014 09:35:00 GMT</pubDate><guid>http://www.tkk7.com/keweibo/articles/416374.html</guid><wfw:comment>http://www.tkk7.com/keweibo/comments/416374.html</wfw:comment><comments>http://www.tkk7.com/keweibo/articles/416374.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/keweibo/comments/commentRss/416374.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/keweibo/services/trackbacks/416374.html</trackback:ping><description><![CDATA[<p style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 10px auto; font: 13px/20px georgia, verdana, Arial, helvetica, sans-seriff; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(75,75,75); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">鍗佽繘鍒朵笌鍗佸叚榪涘埗鐨勮漿鎹?br />8i浠ヤ笂鐗堟湰錛?/p> <p style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 10px auto; font: 13px/20px georgia, verdana, Arial, helvetica, sans-seriff; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(75,75,75); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">鍗佽繘鍒?->鍗佸叚榪涘埗 <br />select to_char(100,'XX') from dual;</p> <p style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 10px auto; font: 13px/20px georgia, verdana, Arial, helvetica, sans-seriff; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(75,75,75); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">鍗佸叚榪涘埗-->鍗佽繘鍒?br />select to_number('7D','XX') from dual;</p><br /><span style="color: red">鍏朵腑XX涓烘牸寮忥紝娉ㄦ剰XX鐨勪綅鏁頒笉鑳藉皬浜?/span>浼犲叆鐨勫弬鏁般?br /><img src ="http://www.tkk7.com/keweibo/aggbug/416374.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/keweibo/" target="_blank">Ke</a> 2014-07-30 17:35 <a href="http://www.tkk7.com/keweibo/articles/416374.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>JavaScript涓疄鐜板嚱鏁伴噸杞藉拰鍙傛暟榛樿鍊?杞?http://www.tkk7.com/keweibo/articles/416152.htmlKeKeThu, 24 Jul 2014 01:22:00 GMThttp://www.tkk7.com/keweibo/articles/416152.htmlhttp://www.tkk7.com/keweibo/comments/416152.htmlhttp://www.tkk7.com/keweibo/articles/416152.html#Feedback0http://www.tkk7.com/keweibo/comments/commentRss/416152.htmlhttp://www.tkk7.com/keweibo/services/trackbacks/416152.html杞嚜錛?a >http://www.2cto.com/kf/201208/149413.html

鍙傛暟榛樿鍊兼槸鎸囧湪璋冪敤鍑芥暟鏃訛紝鑻ョ渷鐣ヤ簡鏌愪釜瀹炲弬錛屽嚱鏁頒細(xì)鑷姩涓鴻鍙傛暟鍒嗛厤涓涓粯璁ゅ鹼紝浣垮緱鍑芥暟璋冪敤鐨勬柟渚挎у拰鐏墊椿鎬уぇ澶ф彁楂樸?/p>

涓句釜渚嬪瓙錛屾瘮濡?a style="color: rgb(51,51,51); font-size: 14px; text-decoration: none" class="keylink" target="_blank">PHP涓殑瀛楃涓叉埅鍙栧嚱鏁皊ubstr(string,start,length)錛屽綋涓嶆寚瀹歭ength鏃訛紝鍑芥暟灝嗛粯璁ゆ埅鍙栧瓧絎︿覆涓璼tart浣嶇疆鍒板瓧絎︿覆緇撴潫錛岃屽鏋滄寚瀹氫簡length錛屽垯鎴彇浠巗tart浣嶇疆寮濮嬬殑浠ength涓洪暱搴︾殑瀛楃涓詫紝鎵浠ュ鏋滆皟鐢ㄧ殑鏄痵ubstr('http://www.hualai.net.cn',11,6)錛屽垯榪斿洖鐨勬槸hualai錛涘鏋滅渷鐣ユ帀鏈鍚庝竴涓弬鏁幫紝substr('http://www.hualai.net.cn',11)錛屽垯榪斿洖hualai.net.cn銆?/p>

鍐嶆瘮濡俲Query妗嗘灦涓紝$(selector).html()鏂規(guī)硶鏄幏鍙栬鍏冪礌鍐呯殑HTML浠g爜錛岃?(selector).html(content)鍒欐槸璁劇疆璇ュ厓绱犲唴鐨凥TML銆傛垜浠煡閬擄紝鍦–璇█涓紝鎴戜滑鍙互閫氳繃濡備笅褰㈠紡鏉ヤ負(fù)鍑芥暟鍙傛暟璁劇疆榛樿鍊鹼細(xì)

[cpp] 
void foo(int a, int b = 1, bool c = false);   
鍦?a style="color: rgb(51,51,51); font-size: 14px; text-decoration: none" class="keylink" target="_blank">Java涓紝鍒欏彲浠ラ氳繃鍑芥暟閲嶈澆鏉ヨ緗嚱鏁板弬鏁伴粯璁ゅ鹼細(xì)

[java]
public void foo(int a){   
    foo(a, 1);   
}   
public void foo(int a, int b){   
    foo(a, b, false);   
}   
public void foo(int a, int b, bool c){   
    //鍑芥暟鍐呭   
}   
鑰屽湪JavaScript涓紝濡備綍鍍廽Query閭f牱璁劇疆鍑芥暟鍙傛暟榛樿鍊煎憿錛烰avaScript涓茍娌℃湁鍍廋璇█涓畾涔夊嚱鏁版椂鐩存帴鍦ㄥ弬鏁板悗闈㈣祴鍊肩殑鏂規(guī)硶錛屼篃娌℃湁鍍廕ava閲岄偅鏍風(fēng)殑鍑芥暟閲嶈澆錛屼絾鎴戜滑鍙互閫氳繃JavaScript鏂規(guī)硶涓殑涓涓猘rguments鍙鍙橀噺鏁扮粍鏉ュ疄鐜幫紝鍏蜂綋濡備笅錛?/p>

[js] 
function foo(){   
    var a = arguments[0] ? arguments[0] : 1;   
    var b = arguments[1] ? arguments[1] : false;   
    //鍑芥暟鍐呭   
}   
浠ヤ笂鏄氳繃鍒ゆ柇鍙傛暟鏄惁瀛樺湪錛岃嫢涓嶅瓨鍦ㄥ垯灝嗛粯璁ゅ奸檮緇欏彉閲忥紝鑰屾垜浠彲浠ラ氳繃鍒ゆ柇鍙傛暟鐨勭被鍨嬫潵瀹炵幇閲嶈澆錛?/p>

[js] 
function foo(){   
    if(typeof arguments[0] == 'string')    
        alert('鍙傛暟綾誨瀷涓哄瓧絎︿覆');    
    else if(typeof arguments[0] == 'number')    
        alert('鍙傛暟綾誨瀷涓烘暟鍊?);    
}   
鎴栬咃細(xì)

[js] 
function foo(){   
    if(arguments[0].constructor == String)    
        alert('鍙傛暟綾誨瀷涓哄瓧絎︿覆');    
    else if(arguments[0].constructor == Number)    
        alert('鍙傛暟綾誨瀷涓烘暟鍊?);    
}   



Ke 2014-07-24 09:22 鍙戣〃璇勮
]]>
SQL Server 2005涓殑CTE閫掑綊鏌ヨ寰楀埌涓媯墊爲(wèi) (杞?http://www.tkk7.com/keweibo/articles/415936.htmlKeKeThu, 17 Jul 2014 06:46:00 GMThttp://www.tkk7.com/keweibo/articles/415936.htmlhttp://www.tkk7.com/keweibo/comments/415936.htmlhttp://www.tkk7.com/keweibo/articles/415936.html#Feedback0http://www.tkk7.com/keweibo/comments/commentRss/415936.htmlhttp://www.tkk7.com/keweibo/services/trackbacks/415936.htmlhttp://blog.csdn.net/bin_520_yan/article/details/5998349

鎰熻榪欎釜CTE閫掑綊鏌ヨ铔ソ鐢ㄧ殑錛屽厛涓句釜渚嬪瓙錛?/p>

 

  1. use City;  
  2. go  
  3. create table Tree  
  4. (  
  5.   ID int identity(1,1) primary key not null,  
  6.   Name varchar(20) not null,  
  7.   Parent varchar(20) null  
  8. )  
  9. go  
  10. insert Tree values('澶у',null)  
  11. insert Tree values('瀛﹂櫌','澶у')  
  12. insert Tree values('璁$畻鏈哄闄?,'瀛﹂櫌')  
  13. insert Tree values('緗戠粶宸ョ▼','璁$畻鏈哄闄?)  
  14. insert Tree values('淇℃伅綆$悊','璁$畻鏈哄闄?)  
  15. insert Tree values('鐢?shù)淇″闄?,'瀛﹂櫌')  
  16. insert Tree values('鏁欏姟澶?,'澶у')  
  17. insert Tree values('鏉愭枡縐?,'鏁欏姟澶?)  
  18. insert Tree values('鎷涚敓鍔?,'澶у')  
  19. go  
  20. with CTE as  
  21. (  
  22. -->Begin 涓涓畾浣嶇偣鎴愬憳  
  23.  select ID, Name,Parent,cast(Name as nvarchar(max)) as TE,0 as Levle from Tree where Parent is null  
  24. -->End   
  25. union all  
  26. -->Begin涓涓掑綊鎴愬憳  
  27.  select Tree.ID, Tree.Name,Tree.Parent,cast(replicate(' ',len(CTE.TE))+'|_'+Tree.name as nvarchar(MAX)) as TE,Levle+1 as Levle  
  28.         from Tree inner join CTE  
  29.         on Tree.Parent=CTE.Name  
  30. -->End  
  31. )  
  32. select * from CTE order by ID  
  33. --1.灝?nbsp;CTE 琛ㄨ揪寮忔媶鍒嗕負(fù)瀹氫綅鐐規(guī)垚鍛樺拰閫掑綊鎴愬憳銆?nbsp; 
  34. --2.榪愯瀹氫綅鐐規(guī)垚鍛橈紝鍒涘緩絎竴涓皟鐢ㄦ垨鍩哄噯緇撴灉闆?nbsp;(T0)銆?nbsp; 
  35. --3.榪愯閫掑綊鎴愬憳錛屽皢 Ti 浣滀負(fù)杈撳叆(榪欓噷鍙湁涓鏉¤褰?錛屽皢 Ti+1 浣滀負(fù)杈撳嚭銆?nbsp; 
  36. --4.閲嶅姝ラ 3錛岀洿鍒拌繑鍥炵┖闆嗐?nbsp; 
  37. --5.榪斿洖緇撴灉闆嗐傝繖鏄 T0 鍒?nbsp;Tn 鎵ц UNION ALL 鐨勭粨鏋溿?nbsp; 

 

涓婇潰鐨凷QL璇彞鍐嶆鎻掑叆涓鏉℃暟鎹細(xì)

insert Tree values('緗戠粶1鐝?,'緗戠粶宸ョ▼')

     榪愯緇撴灉濡備笅鍥撅細(xì)

鍥? 榪愯緇撴灉

     娉ㄦ剰鐐癸細(xì)璨屼技鍦ㄩ掑綊鎴愬憳澶勬墍閫夋嫨鐨勫瓧孌甸兘蹇呴』Tree琛ㄧ殑鏁版嵁錛岃屼笉鑳芥槸CTE緇撴灉闆嗕腑鐨勯櫎浜員ree涓病鏈夎孋TE涓湁鐨勫瓧孌靛湪榪欓噷鎵嶅彲浠ュ紩鐢紝姣斿瀛楁TE銆?/p>

    棣栧厛鐪嬩笅錛岄亶鍘嗙殑絎?鏉¤褰曠殑SQL璇彞錛?/p>

  1. select ID, Name,Parent,cast(Name as nvarchar(max)) as TE,0 as Levle from Tree where Parent is null  

 

   鑾峰彇鐨勭粨鏋滀負(fù)錛?/p>

   Name  Parent   TE    Levle

-------------------------------------

     澶у    NULL   澶у     0

   閫掑綊絎?嬈℃墍鑾峰彇鐨勭粨鏋滈泦鍚堢殑綾籗QL璇彞涓猴細(xì)

  1. select Tree.ID, Tree.Name,Tree.Parent,cast(replicate(' ',len(CTE.TE))+'|_'+Tree.name as nvarchar(MAX)) as TE,Levle+1 as Levle  
  2. from Tree inner join  
  3.    (select ID, Name,Parent,cast(Name as nvarchar(max)) as TE,0 as Levle from Tree where Parent is null)  
  4. as CTE  
  5. on Tree.Parent=CTE.Name  

 

   涓婇潰鐨凜TE瀛愭煡璇㈢殑緇撴灉灝辨槸絎竴嬈¢掑綊鏌ヨ鐨勭粨鏋滈泦錛屼笂闈QL榪愯緇撴灉涓猴細(xì)

   鍚屾牱鐨勶紝灝嗙浜屾閫掑綊鏌ヨ鐨勪笂闈笁鏉¤褰曚綔涓虹涓夋鏌ヨ鐨?#8216;瀹氫綅鎴愬憳’錛?/p>

  銆愯繖閲岃娉ㄦ剰錛屼笂闈㈢殑涓夋潯璁板綍鏄粠鏈鍚庝竴鏉″紑濮嬩緷嬈′綔涓虹涓夋閫掑綊鐨勮緭鍏ョ殑錛屽嵆絎竴鏉℃槸ID=9鐨勮褰曪紝鎺ヤ笅鏉ユ槸7鍜?錛屽叧浜庣鍥涙閫掑綊涔熺被浼箋?/p>

   絎笁嬈¢掑綊綾籗QL璇彞

  1. select Tree.ID, Tree.Name,Tree.Parent,cast(replicate(' ',len(CTE.TE))+'|_'+Tree.name as nvarchar(MAX)) as TE,Levle+1 as Levle  
  2. from Tree inner join  
  3. (絎簩嬈¢掑綊鏌ヨ鐨凷QL璇彞)as CTE  
  4. on Tree.Parent=CTE.Name  

 

   緇撴灉濡備笅錛?/p>

鍏跺疄姣忔閫掑綊鐨勭被SQL鍙負(fù)濡備笅鎵紺猴細(xì)

  1. select Tree.ID, Tree.Name,Tree.Parent,cast(replicate(' ',len(CTE.TE))+'|_'+Tree.name as nvarchar(MAX)) as TE,Levle+1 as Levle  
  2. from Tree inner join  
  3. (涓婃閫掑綊鏌ヨ鐨勭粨鏋滈泦錛屼粎浠呮槸涓婃閭d竴嬈$殑錛岃屼笉鏄互鍓嶇殑鎬誨拰緇撴灉闆?  
  4. as CTE  
  5. on Tree.Parent=CTE.Name  

 

 絎洓嬈¢掑綊涓嬈$被鎺紝鏈鍚庢墍鏌ヨ鐨勭粨鏋滀負(fù)涓婇潰鎵鏈夐掑綊鐨剈nion銆?/p>

 緇細(xì)鍦ㄤ笂闈㈢殑SQ璇彞鏌ヨ緇撴灉涓紝ID涓?0鐨勮褰曞簲璇ヨ鏀懼湪ID涓?鐨勫悗闈€?/p>

 寰鏁版嵁琛ㄤ腑鍐嶆娣誨姞涓ゆ潯璁板綍錛?/p>

insert Tree values('璁$','璁$畻鏈哄闄?)
insert Tree values('鎴?,'緗戠粶1鐝?) 

鍐嶆淇敼涓婇潰鐨凷QL璇彞錛?/p>

  1. with CTE as    
  2. (     
  3. -->Begin 涓涓畾浣嶇偣鎴愬憳     
  4.  select ID, Name,Parent,cast(Name as nvarchar(max)) as TE,  
  5.         ROW_NUMBER()over(order by getdate()) as OrderID  
  6.         --鏈鍏抽敭鏄笂闈㈣繖涓瓧孌碉紝瑕佽幏鍙栨帓搴忓瓧孌碉紝鎸夊瓧絎︿覆鏉ユ帓搴忋?nbsp; 
  7.         --鍏朵腑紿楀彛鍑芥暟蹇呴』瑕佷嬌鐢╫rder by錛屼絾鏄笉鑳界敤鏁村瀷錛岄偅灝辯敤鏃墮棿鍚?nbsp; 
  8.         from Tree where Parent is null    
  9. -->End      
  10. union all     
  11. -->Begin涓涓掑綊鎴愬憳     
  12.  select Tree.ID, Tree.Name,Tree.Parent,cast(replicate(' ',len(CTE.TE))+'|_'+Tree.name as nvarchar(MAX)) as TE,  
  13.         CTE.OrderID*100+ROW_NUMBER()over(Order by GETDATE()) as OrderID  
  14.         from Tree inner join CTE     
  15.         on Tree.Parent=CTE.Name     
  16. -->End     
  17. )     
  18. select * from CTE  
  19. order by LTRIM(OrderID)--鏈鍚庡皢榪欎釜鏁村瀷鏁版嵁杞崲涓哄瓧絎︿覆鍨嬬殑榪涜鎺掑簭  
  20.   
  21. --鏈夋椂鍊欐暣鍨嬪彲浠ユ瘮澶у皬錛屽瓧絎︿覆涔熷彲浠ワ紝瀛楃涓叉瘮鐨勫ぇ灝忔槸涓浣嶄竴浣嶈繘琛屽瓧絎︽瘮杈冪殑  
  22. --鏁村瀷+瀛楃涓?=鏁村瀷錛屽彧鏈夊瓧絎︿覆+瀛楃涓?=涓や釜瀛楃涓茬殑騫跺拰  
  23. --閫掑綊鏌ヨ涓細(xì)絎簩鏉¤褰曞彲浠ュ紩鐢ㄧ涓鏉¤褰曠殑鍊?nbsp; 
  24. --鍔ㄦ佸姞杞借褰曟椂錛屽悓涓涓瓑綰х殑璁板綍璇嗗埆絎︼細(xì)RowNumber()over(order by getdate())  
  25. --寤朵幾錛氬彲浠ュ姩鎬佽幏鍙栨煇涓儴闂ㄤ笅鐨勬墍浠ュ瓙閮ㄩ棬銆備篃鍙互鑾峰彇璇ラ儴闂ㄤ笂綰х殑鎵浠ラ儴闂?nbsp; 
  26.   
  27. --鎬葷粨錛氶鍏堣鎷煎噾鍑轟竴涓暣鍨嬫暟鎹紝鐒跺悗杞崲涓哄瓧絎︿覆錛屾渶鍚庢槸榪涜瀛楃涓茬殑order錛岃屼笉鏄暣鍨嬫暟鎹殑order錛?nbsp; 

 

鏈鍚庣殑緇撴灉涓猴細(xì)

鍥? 榪愯緇撴灉

榪欐牱錛屾棤璁虹敤鎴鋒彃鍏ュ灝戞潯璁板綍閮藉彲浠ヨ繘琛屾寜閮ㄩ棬錛屾寜瑙勫緥榪涜鏌ヨ銆?/p>

Ke 2014-07-17 14:46 鍙戣〃璇勮
]]>
DataTable鏇存柊鏁版嵁鎿嶄綔(杞?http://www.tkk7.com/keweibo/articles/415278.htmlKeKeMon, 30 Jun 2014 07:49:00 GMThttp://www.tkk7.com/keweibo/articles/415278.htmlhttp://www.tkk7.com/keweibo/comments/415278.htmlhttp://www.tkk7.com/keweibo/articles/415278.html#Feedback0http://www.tkk7.com/keweibo/comments/commentRss/415278.htmlhttp://www.tkk7.com/keweibo/services/trackbacks/415278.html

BLL灞?nbsp;     

  public void Update(DataTable dt)
        {
            foreach (DataRow dr in dt.Rows)
            {
                if (dr.RowState == DataRowState.Deleted)
                    continue;
                if (dr.RowState == DataRowState.Modified || dr.RowState == DataRowState.Added)
                {
                    if (dr["usr_id"] == DBNull.Value)
                    {
                        throw new Exception("鐢ㄦ埛浠g爜涓嶈兘涓虹┖");
                    }                }
            }

            dal.Update(dt);
        }

       

DAL灞?/p>

 public void Update(DataTable dt)
        {
            SqlDataAdapter adapter = new SqlDataAdapter();
            SqlConnection conn = new SqlConnection(SqlHelper.ConnectionString);
            conn.Open();

            adapter.InsertCommand = new SqlCommand("INSERT INTO dbo.t6( com_id ,usr_id ) VALUES( @com_id ,@usr_id)", conn);
            adapter.InsertCommand.CommandType = CommandType.Text;
            adapter.InsertCommand.Parameters.Add("@com_id", SqlDbType.VarChar, 4, "com_id");
            adapter.InsertCommand.Parameters.Add("@usr_id", SqlDbType.VarChar, 8, "usr_id");

            adapter.UpdateCommand = new SqlCommand("update t6 setwhereand usr_id", conn);
            adapter.UpdateCommand.CommandType = CommandType.Text;
            adapter.UpdateCommand.Parameters.Add("@com_id", SqlDbType.VarChar, 4, "com_id");
            adapter.UpdateCommand.Parameters.Add("@usr_id", SqlDbType.VarChar, 8, "usr_id");
            adapter.UpdateCommand.Parameters.Add("@usr_id1", SqlDbType.VarChar, 8, "usr_id");
            adapter.UpdateCommand.Parameters["@usr_id1"].SourceVersion = DataRowVersion.Original;

            adapter.DeleteCommand = new SqlCommand("delete from t6 whereand usr_id", conn);
            adapter.DeleteCommand.CommandType = CommandType.Text;
            adapter.DeleteCommand.Parameters.Add("@com_id", SqlDbType.VarChar, 4, "com_id");
            adapter.DeleteCommand.Parameters.Add("@usr_id", SqlDbType.VarChar, 8, "usr_id");

            adapter.DeleteCommand.Parameters["@com_id"].SourceVersion = DataRowVersion.Original;
            adapter.DeleteCommand.Parameters["@usr_id"].SourceVersion = DataRowVersion.Original;

            adapter.Update(dt);
        }

 

鍓嶅彴

    public partial class DataTableUpdate : Form
    {

        public BLL.Users Bu = new BLL.Users();
        public DataTable dtUsr = new DataTable();
        public MOD.Users modObject = new MOD.Users();

        public string _UserId = "";

        public DataTableUpdate()
        {
            InitializeComponent();
            dataGridView1.AutoGenerateColumns = false;
        }

//紿楀彛鍔犺澆

        private void Form1_Load(object sender, EventArgs e)
        {
            dtUsr = Bu.GetList();
            dataGridView1.DataSource = dtUsr;
            BindValue();
        }

        private void BindValue()
        {
            tb_com_id.DataBindings.Add("Text", dataGridView1.DataSource, "com_id");
            tb_UsrId.DataBindings.Add("Text", dataGridView1.DataSource, "usr_id");

            //鎵嬪姩淇敼鍙互; 浠g爜璧嬪奸渶瑕佺敤涓嬮潰榪欏彞璇?br />            tb_UsrId.DataBindings[0].DataSourceUpdateMode = DataSourceUpdateMode.OnPropertyChanged;
        }

        private void 淇濆瓨_Click(object sender, EventArgs e)
        {
            foreach (DataRow dr in dtUsr.Rows)
            {
                dr.EndEdit();
            }
            try
            {
                Bu.Update(dtUsr);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return;
            }
            MessageBox.Show("淇濆瓨鎴愬姛錛?, "緋葷粺鎻愮ず");
        }

        private void 鍒犻櫎_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("鎮(zhèn)ㄧ‘璁よ鍒犻櫎鐢ㄦ埛錛? + tb_UsrName.Text.Trim()+" ?", "鎻愮ず", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.No)
                return;

            if (dataGridView1.CurrentCell == null)
                return;

            try
            {
                dataGridView1.Rows.Remove(dataGridView1.CurrentRow);
                Bu.Update(dtUsr);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return;
            }
            MessageBox.Show("鍒犻櫎鎴愬姛錛?, "緋葷粺鎻愮ず");
           
        }

        private void 澧炲姞_Click(object sender, EventArgs e)
        {
            DataRow dr = dtUsr.NewRow();
            dr["usr_id"] = _UserId;
            dtUsr.Rows.Add(dr);
            dataGridView1.CurrentCell = dataGridView1.Rows[dataGridView1.Rows.Count - 1].Cells[0];
        }

        private void 鍙栨秷_Click(object sender, EventArgs e)
        {
            dtUsr.RejectChanges();
        }
鐗涢搧錛?a style="color: rgb(63,167,203); text-decoration: underline" >http://blog.csdn.net/fangxinggood/archive/2008/04/18/2304047.aspx



Ke 2014-06-30 15:49 鍙戣〃璇勮
]]>
鍦ㄦ暟鎹〃(DataTable)涓搷浣滄暟鎹?杞?http://www.tkk7.com/keweibo/articles/415272.htmlKeKeMon, 30 Jun 2014 03:08:00 GMThttp://www.tkk7.com/keweibo/articles/415272.htmlhttp://www.tkk7.com/keweibo/comments/415272.htmlhttp://www.tkk7.com/keweibo/articles/415272.html#Feedback0http://www.tkk7.com/keweibo/comments/commentRss/415272.htmlhttp://www.tkk7.com/keweibo/services/trackbacks/415272.html杞嚜錛?a >http://blog.csdn.net/cui55/article/details/1371411

鍦?span class="Apple-converted-space"> DataSet 涓垱寤?span class="Apple-converted-space"> DataTable 涔嬪悗錛屾?zhèn)ㄦ墽琛岀殑娲诲姩鍙互涓庝娇鐢ㄦ暟鎹簱涓殑琛ㄦ椂鎵ц鐨剫z誨姩鐩稿悓銆傛?zhèn)ㄥ彲浠ユ氛d姞銆佹煡鐪嬨佺紪杈戝拰鍒犻櫎琛ㄤ腑鐨勬暟鎹紱鍙互鐩戣閿欒鍜屼簨浠訛紱騫朵笖鍙互鏌ヨ琛ㄤ腑鐨勬暟鎹傚湪淇敼 DataTable 涓殑鏁版嵁鏃訛紝鎮(zhèn)ㄤ篃鍙互楠岃瘉鏇存敼鏄惁姝g‘錛屽茍鍐沖畾鏄惁浠ョ紪紼嬫柟寮忔帴鍙楁洿鏀規(guī)垨鎷掔粷鏇存敼銆?/p>

鏈妭鍐呭

灝嗘暟鎹坊鑷寵〃涓?/font>:璇存槑濡備綍鍒涘緩鏂拌騫跺皢鍏舵坊鑷寵〃涓?/p>
鍦ㄥ垱寤?span class="Apple-converted-space"> DataTable 騫朵嬌鐢ㄥ垪鍜岀害鏉熷畾涔夊叾緇撴瀯涔嬪悗錛屾?zhèn)ㄥ彲浠畣鏂扮殑鏁版嵁琛屾坊鑷宠〃涓傝娣誨姞鏂拌錛屽彲灝嗕竴涓柊鍙橀噺澹版槑涓?span class="Apple-converted-space"> DataRow 綾誨瀷銆傝皟鐢?span class="Apple-converted-space"> NewRow 鏂規(guī)硶鏃訛紝灝嗚繑鍥炴柊鐨?span class="Apple-converted-space"> DataRow 瀵硅薄銆傜劧鍚庯紝DataTable 浼?xì)鏍规嵁琛ㄧ殑缁撴瀯鎸?span id="jfr3vdz" class="Apple-converted-space"> DataColumnCollection 鐨勫畾涔夊垱寤?span class="Apple-converted-space"> DataRow 瀵硅薄銆?

浠ヤ笅紺轟緥婕旂ず浜嗗浣曢氳繃璋冪敤 NewRow 鏂規(guī)硶鏉ュ垱寤烘柊琛屻?/p>

DataRow workRow = workTable.NewRow();

鐒跺悗鎮(zhèn)ㄥ彲浠ヤ嬌鐢ㄧ儲(chǔ)寮曟垨鍒楀悕鏉ユ搷浣滄柊娣誨姞鐨勮錛屽涓嬩緥鎵紺恒?/p>

workRow["CustLName"] = "Smith";
workRow[1] = "Smith";

鍦ㄥ皢鏁版嵁鎻掑叆鏂拌鍚庯紝Add 鏂規(guī)硶鍙敤浜庡皢琛屾坊鑷?span class="Apple-converted-space"> DataRowCollection錛屽浠ヤ笅浠g爜鎵紺恒?/p>

workTable.Rows.Add(workRow);

鎮(zhèn)ㄤ篃鍙互閫氳繃浼犲叆鍊肩殑鏁扮粍錛堢被鍨嬪寲涓?span class="Apple-converted-space"> Object錛夛紝璋冪敤 Add 鏂規(guī)硶鏉ユ坊鍔犳柊琛岋紝濡備笅渚嬫墍紺恒?/p>

workTable.Rows.Add(new Object[] {1, "Smith"});

灝嗙被鍨嬪寲涓?span class="Apple-converted-space"> Object 鐨勫肩殑鏁扮粍浼犻掑埌 Add 鏂規(guī)硶錛屽彲鍦ㄨ〃鍐呭垱寤烘柊琛屽茍灝嗗叾鍒楀艱緗負(fù)瀵硅薄鏁扮粍涓殑鍊箋傝娉ㄦ剰錛屾暟緇勪腑鐨勫間細(xì)鏍規(guī)嵁瀹冧滑鍦ㄨ〃涓嚭鐜扮殑欏哄簭鐩哥戶涓庡悇鍒楀尮閰嶃?/p>

浠ヤ笅紺轟緥灝嗗崄琛屾坊鑷蟲柊寤虹殑 Customers 琛ㄤ腑銆?/p>

DataRow workRow;

for (int i = 0; i <= 9; i++) 
{
  workRow = workTable.NewRow();
  workRow[0] = i;
  workRow[1] = "CustName" + i.ToString();
  workTable.Rows.Add(workRow);
}

鏌ョ湅琛ㄤ腑鏁版嵁:璇存槑濡備綍璁塊棶琛屼腑鐨勬暟鎹紝鍖呮嫭鏁版嵁鐨勫師濮嬬増鏈拰褰撳墠鐗堟湰銆?/p>
鍙互浣跨敤 DataTable 鐨?span class="Apple-converted-space"> Rows 鍜?span class="Apple-converted-space"> Columns 闆嗗悎鏉ヨ闂?span class="Apple-converted-space"> DataTable 涓殑鍐呭銆備篃鍙互鏍規(guī)嵁鍖呮嫭鎼滅儲(chǔ)鏍囧噯銆佹帓搴忛『搴忓拰琛岀姸鎬佺瓑鐗瑰畾鏍囧噯錛屼嬌鐢?span class="Apple-converted-space"> DataTable.Select 鏂規(guī)硶榪斿洖 DataTable 涓暟鎹殑瀛愰泦銆傛澶栵紝鐢ㄤ富閿兼悳绱㈢壒瀹氳鏃訛紝榪樺彲浣跨敤 DataRowCollection 鐨?span class="Apple-converted-space"> Find 鏂規(guī)硶銆?

DataTable 瀵硅薄鐨?span class="Apple-converted-space"> Select 鏂規(guī)硶榪斿洖涓緇勪笌鎸囧畾鏉′歡鍖歸厤鐨?span class="Apple-converted-space"> DataRow 瀵硅薄銆?strong>Select 閲囩敤絳涢夎〃杈懼紡銆佹帓搴忚〃杈懼紡鍜?span class="Apple-converted-space"> DataViewRowState 鐨勫彲閫夊弬鏁般傜瓫閫夎〃杈懼紡鏍規(guī)嵁 DataColumn 鍊鹼紙渚嬪 LastName = 'Smith'銆傛帓搴忚〃杈懼紡閬靛驚鐢ㄤ簬涓哄垪鎺掑簭鐨勬爣鍑?SQL 綰﹀畾錛屼緥濡?span class="Apple-converted-space"> LastName ASC, FirstName ASC銆傛湁鍏崇紪鍐欒〃杈懼紡鐨勮鍒欙紝璇峰弬闃?strong>DataColumn 綾葷殑 Expression 灞炴с?/p>

鎻愮ず 濡傛灉鎮(zhèn)ㄥ皢瀵?span class="Apple-converted-space"> DataTable 鐨?span class="Apple-converted-space"> Select 鏂規(guī)硶鎵ц澶氭璋冪敤錛屽彲閫氳繃鍏堜負(fù) DataTable 鍒涘緩 DataView鏉ユ彁楂樻ц兘銆傚垱寤?span class="Apple-converted-space"> DataView 浼?xì)湄?fù)琛ㄤ腑鐨勮緙栧埗绱㈠紩銆傜劧鍚庯紝Select 鏂規(guī)硶浼?xì)鋴社敤璇ョ储寮曞Q岃繖鏍峰皢鏄捐憲緙╃煭鐢熸垚鏌ヨ緇撴灉鐨勬椂闂淬傛湁鍏充負(fù) DataTable 鍒涘緩 DataView 鐨勪俊鎭紝璇峰弬闃?a style="color: rgb(51,102,153); text-decoration: none" >鍒涘緩鍜屼嬌鐢?DataView銆?/blockquote>

Select 鏂規(guī)硶鍩轟簬 DataViewRowState 紜畾瑕佹煡鐪嬫垨鎿嶄綔鐨勮鐨勭増鏈備笅琛ㄨ鏄庝簡鍙兘鐨?span class="Apple-converted-space"> DataViewRowState 鏋氫婦鍊箋?/p>

鎴愬憳鍚嶇О 璇存槑
CurrentRows 褰撳墠琛岋紝鍖呮嫭鏈洿鏀圭殑琛屻佸凡娣誨姞鐨勮鍜屽凡淇敼鐨勮銆?/td>
Deleted 宸插垹闄ょ殑琛屻?/td>
ModifiedCurrent 褰撳墠鐗堟湰錛屽畠鏄師濮嬫暟鎹殑淇敼鐗堟湰錛堣鍙傞槄ModifiedOriginal錛夈?/td>
ModifiedOriginal 鎵鏈夊凡淇敼琛岀殑鍘熷鐗堟湰銆備嬌鐢?span class="Apple-converted-space"> ModifiedCurrent 鏃訛紝褰撳墠鐗堟湰鍙敤銆?/td>
Added 鏂拌銆?/td>
None 鏃犮?/td>
OriginalRows 鍘熷琛岋紝鍖呮嫭鏈洿鏀圭殑琛屽拰宸插垹闄ょ殑琛屻?/td>
Unchanged 鏈洿鏀圭殑琛屻?/td>

鍦ㄤ笅闈㈢殑紺轟緥涓紝DataSet 瀵硅薄宸茬粡榪囩瓫閫夛紝榪欐牱錛屾?zhèn)ㄥ彲浠ュ彧鋴社敤鍏?span id="plhrtxb" class="Apple-converted-space"> DataViewRowState 璁劇疆涓?span class="Apple-converted-space"> CurrentRows鐨勮銆?/p>

DataRow[] currRows = workTable.Select(null, null, DataViewRowState.CurrentRows);

if (currRows.Length < 1 )
  Console.WriteLine("No Current Rows Found");
else
{
  foreach (DataColumn myCol in workTable.Columns)
    Console.Write("/t{0}", myCol.ColumnName);

  Console.WriteLine("/tRowState");

  foreach (DataRow myRow in currRows)
  {
    foreach (DataColumn myCol in workTable.Columns)
      Console.Write("/t{0}", myRow[myCol]);

    Console.WriteLine("/t" + myRow.RowState);
  }
}

Select 鏂規(guī)硶鍙敤浜庤繑鍥炲叿鏈変笉鍚?span class="Apple-converted-space"> RowState 鍊兼垨瀛楁鍊肩殑琛屻備互涓嬬ず渚嬭繑鍥炰竴涓紩鐢ㄦ墍鏈夊凡鍒犻櫎琛岀殑 DataRow鏁扮粍錛屽茍榪斿洖鍙︿竴涓紩鐢ㄦ墍鏈夊凡鎺掑簭琛岋紙鎸夌収 CustLName 鎺掑簭錛屽叾涓?span class="Apple-converted-space"> CustID 鍒楀ぇ浜?5錛夌殑 DataRow 鏁扮粍銆?/p>

// Retrieve all deleted rows.
DataRow[] delRows = workTable.Select(null, null, DataViewRowState.Deleted);

// Retrieve rows where CustID > 5, and order by CustLName.
DataRow[] custRows = workTable.Select("CustID > 5", "CustLName ASC");

緙栬緫琛ㄤ腑鐨勬暟鎹?/font>:璇存槑濡備綍淇敼琛屼腑鐨勬暟鎹紝鍖呮嫭鎸傝搗瀵硅鐨勬洿鏀癸紝鐩磋嚦楠岃瘉騫舵帴鍙椾簡寤鴻鐨勬洿鏀廣?/p>
褰撴?zhèn)ㄥ?span class="Apple-converted-space"> DataRow 涓洿鏀瑰垪鍊兼椂錛屾墍鍋氭洿鏀逛細(xì)绔嬪嵆緗簬琛岀殑 Current 鐘舵佷腑銆傜劧鍚庯紝RowState 浼?xì)璁揪|負(fù)Modified錛屽茍浣跨敤 DataRow 鐨?span class="Apple-converted-space"> AcceptChanges 鎴?span class="Apple-converted-space"> RejectChanges 鏂規(guī)硶鏉ユ帴鍙楁垨鎷掔粷鎵鍋氭洿鏀廣?strong>DataRow榪樻彁渚涗簡涓夌鍙敤浜庡湪緙栬緫琛屾椂灝嗚鐨勭姸鎬佹寕璧風(fēng)殑鏂規(guī)硶銆傝繖浜涙柟娉曟槸 BeginEdit銆?strong>EndEdit 鍜?span class="Apple-converted-space"> CancelEdit銆?

褰撴?zhèn)ㄧ洿鎺ュ?span class="Apple-converted-space"> DataRow 涓慨鏀瑰垪鍊兼椂錛?strong>DataRow 浼?xì)鋴社?span class="Apple-converted-space"> Current銆?strong>Default 鍜?span class="Apple-converted-space"> Original 琛岀増鏈潵綆$悊鍒楀箋傞櫎榪欎簺琛岀増鏈互澶栵紝BeginEdit銆?strong>EndEdit 鍜?span class="Apple-converted-space"> CancelEdit 鏂規(guī)硶榪樹嬌鐢ㄧ鍥涗釜琛岀増鏈細(xì)Proposed銆?/p>

鍦ㄦ墽琛岀紪杈戞搷浣滐紙閫氳繃璋冪敤 BeginEdit 寮濮嬶紝騫朵笖閫氳繃浣跨敤 EndEdit 鎴?span class="Apple-converted-space"> CancelEdit 鎴栬呴氳繃璋冪敤AcceptChanges 鎴?span class="Apple-converted-space"> RejectChanges 緇撴潫錛夌殑榪囩▼涓紝Proposed 琛岀増鏈細(xì)瀛樺湪銆?/p>

鍦ㄧ紪杈戞搷浣滆繃紼嬩腑錛屾?zhèn)ㄥ彲浠ラ氳繃璁$畻 DataTable 鐨?span class="Apple-converted-space"> ColumnChanged 浜嬩歡涓殑 ProposedValue 鏉ュ皢楠岃瘉閫昏緫搴旂敤浜庡悇鍒椼?strong>ColumnChanged 浜嬩歡淇濆瓨 DataColumnChangeEventArgs錛屽彲淇濇寔瀵規(guī)鍦ㄦ洿鏀圭殑鍒楀拰ProposedValue 鐨勫紩鐢ㄣ傝綆椾簡寤鴻鍊煎悗錛屽彲浠ュ鍏惰繘琛屼慨鏀規(guī)垨鍙栨秷緙栬緫銆傜紪杈戠粨鏉熸椂錛岃浠?span class="Apple-converted-space"> Proposed 鐘舵佷腑縐誨嚭銆?/p>

鎮(zhèn)ㄥ彲浠ラ氳繃璋冪敤 EndEdit 鏉ョ‘璁ょ紪杈戯紝涔熷彲浠ラ氳繃璋冪敤 CancelEdit 鏉ュ彇娑堢紪杈戙傝娉ㄦ剰錛屽敖綆?span class="Apple-converted-space"> EndEdit 紜疄宸茬‘璁ゆ?zhèn)ㄦ墍鍋氱殑緙栬緫錛屼絾鍦ㄨ皟鐢?span class="Apple-converted-space"> AcceptChanges 涔嬪墠錛?strong>DataSet 騫舵病鏈夊疄闄呮帴鍙楁洿鏀廣傚彟澶栬娉ㄦ剰錛屽鏋滃湪EndEdit 鎴?span class="Apple-converted-space"> CancelEdit 緙栬緫緇撴潫涔嬪墠璋冪敤 AcceptChanges錛岀紪杈戝皢浼?xì)缁堟锛岒q舵帴鍙?span class="Apple-converted-space"> Current 鍜?span class="Apple-converted-space"> Original 琛岀増鏈殑 Proposed 琛屽箋傝皟鐢?span class="Apple-converted-space"> RejectChanges 浼?xì)浠ュ悓鏍风殑鏂瑰紡缁撴潫缂栬緫锛岒q舵斁寮?span class="Apple-converted-space"> Current 鍜?span class="Apple-converted-space"> Proposed 琛岀増鏈傚湪璋冪敤 AcceptChanges 鎴?span class="Apple-converted-space"> RejectChanges 涔嬪悗璋冪敤 EndEdit 鎴?span class="Apple-converted-space"> CancelEdit 涓嶄細(xì)璧蜂綔鐢紝鍥犱負(fù)緙栬緫宸茬粡緇撴潫銆?/p>

浠ヤ笅紺轟緥婕旂ず浜嗗浣曞皢 BeginEdit 涓?span class="Apple-converted-space"> EndEdit 鍜?span class="Apple-converted-space"> CancelEdit 涓璧蜂嬌鐢ㄣ傛湰紺轟緥涔熶細(xì)媯(gè)鏌?span class="Apple-converted-space"> ColumnChanged 浜嬩歡涓殑 ProposedValue錛屽茍鍐沖畾鏄惁鍙栨秷緙栬緫銆?/p>

DataTable  workTable  = new DataTable();
workTable.Columns.Add("LastName", typeof(String));

workTable.ColumnChanged += new DataColumnChangeEventHandler(OnColumnChanged);

DataRow workRow = workTable.NewRow();
workRow[0] = "Smith";
workTable.Rows.Add(workRow);

workRow.BeginEdit();
// Causes the ColumnChanged event to write a message and cancel the edit.
workRow[0] = "";     
workRow.EndEdit();

// Displays "Smith, New".
Console.WriteLine("{0}, {1}", workRow[0], workRow.RowState);  


protected static void OnColumnChanged(Object sender, DataColumnChangeEventArgs args)
{
  if (args.Column.ColumnName == "LastName")
    if (args.ProposedValue.ToString() == "")
    {
      Console.WriteLine("Last Name cannot be blank. Edit canceled.");
      args.Row.CancelEdit();
    }
}

琛岀姸鎬佷笌琛岀増鏈?/font>:鎻愪緵鏈夊叧琛岀殑涓嶅悓鐘舵佺殑淇℃伅銆?/p>
ADO.NET 鐢ㄨ鐘舵佸拰鐗堟湰綆$悊琛ㄤ腑鐨勮銆傝鐘舵佽〃紺鴻鐨勭姸鎬併傚綋淇敼琛屾椂錛岃鐗堟湰浼?xì)缁存姢瀛樺偍浜庤涓殑鍊鹼紝鍖呮嫭褰撳墠鍊箋佸師濮嬪煎拰榛樿鍊箋備緥濡傦紝淇敼浜嗘煇琛屼腑鐨勪竴鍒楀悗錛岃琛屼細(xì)鏈変竴涓?span class="Apple-converted-space"> Modified 鐨勮鐘舵侊紝騫朵笖浼?xì)瀛樺湪涓や釜琛岀増鏈Q?strong>Current錛堝寘鍚綋鍓嶈鍊鹼級(jí)鍜?span class="Apple-converted-space"> Original錛堝寘鍚慨鏀硅鍒楀墠鐨勮鍊鹼級(jí)銆?

姣忎釜 DataRow 瀵硅薄閮藉叿鏈?span class="Apple-converted-space"> RowState 灞炴э紝鎮(zhèn)ㄥ彲浠ユ鏌ユ灞炴ф潵紜畾琛岀殑褰撳墠鐘舵併備笅琛ㄧ粰鍑轟簡瀵瑰悇RowState 鏋氫婦鍊肩殑綆瑕佽鏄庛?/p>

RowState 璇存槑
Unchanged 鑷笂嬈¤皟鐢?span class="Apple-converted-space"> AcceptChanges 涔嬪悗錛屾垨鑷?span class="Apple-converted-space"> DataAdapter.Fill 鍒涘緩浜嗚涔嬪悗錛屾湭鍋氬嚭榪囦換浣曟洿鏀廣?/td>
Added 宸插皢琛屾坊鑷寵〃涓紝浣嗗皻鏈皟鐢?span class="Apple-converted-space"> AcceptChanges銆?/td>
Modified 宸叉洿鏀逛簡琛岀殑涓浜涘厓绱犮?/td>
Deleted 宸插皢璇ヨ浠庤〃涓垹闄わ紝騫朵笖灝氭湭璋冪敤 AcceptChanges銆?/td>
Detached 瀵逛簬宸茬粡鍒涘緩浣嗕笉灞炰簬浠諱綍 DataRowCollection 鐨勮錛岃緗負(fù) Detached銆傛柊寤鴻鐨?span class="Apple-converted-space"> RowState璁劇疆涓?span class="Apple-converted-space"> Detached銆傞氳繃璋冪敤 Add 鏂規(guī)硶灝嗘柊鐨?span class="Apple-converted-space"> DataRow 娣昏嚦 DataRowCollection 涔嬪悗錛?strong>RowState 灞炴х殑鍊艱緗負(fù) Added銆?

瀵逛簬宸茬粡浣跨敤 Remove 鏂規(guī)硶錛堟垨鏄湪浣跨敤 Delete 鏂規(guī)硶涔嬪悗浣跨敤浜?span class="Apple-converted-space"> AcceptChanges 鏂規(guī)硶錛変粠DataRowCollection 涓Щ闄ょ殑琛岋紝涔熻緗負(fù) Detached銆?/p>

鍦?span class="Apple-converted-space"> DataSet銆?strong>DataTable 鎴?span class="Apple-converted-space"> DataRow 涓婅皟鐢?span class="Apple-converted-space"> AcceptChanges 鏃訛紝浼?xì)绉婚櫎琛岀姸鎬佷負(fù) Deleted 鐨勬墍鏈夎銆傚墿浣欑殑琛屼細(xì)琚祴浜?span class="Apple-converted-space"> Unchanged 琛岀姸鎬侊紝騫朵笖 Original 琛岀増鏈腑鐨勫間細(xì)鏀瑰啓涓?span class="Apple-converted-space"> Current 琛岀増鏈箋傝皟鐢?strong>RejectChanges 鏃訛紝浼?xì)绉婚櫎琛岀姸鎬佷負(fù) Added 鐨勬墍鏈夎銆傚墿浣欑殑琛屼細(xì)琚祴浜?span class="Apple-converted-space"> Unchanged 鐨勮鐘舵侊紝騫朵笖Current 琛岀増鏈腑鐨勫間細(xì)鏀瑰啓涓?span class="Apple-converted-space"> Original 琛岀増鏈箋?/p>

閫氳繃鐢ㄥ垪寮曠敤鏉ヤ紶閫?span class="Apple-converted-space"> DataRowVersion 鍙傛暟錛屾?zhèn)ㄥ彲浠ユ煡鐪嬭鐨勪笉鍚岃鐗堟湰锛屽涓嬩緥鎵紺恒?/p>

DataRow custRow = custTable.Rows[0];
string custID = custRow["CustomerID", DataRowVersion.Original].ToString();

涓嬭〃緇欏嚭浜嗗悇 DataRowVersion 鏋氫婦鍊肩殑綆瑕佽鏄庛?/p>

DataRowVersion 璇存槑
Current 琛岀殑褰撳墠鍊箋傚鏋滄槸鏈?span class="Apple-converted-space"> Deleted 鐨?span class="Apple-converted-space"> RowState 鐨勮錛屽垯涓嶅瓨鍦ㄦ琛岀増鏈?/td>
Default 鐗瑰畾琛岀殑榛樿琛岀増鏈?strong>Added銆?strong>Modified 鎴?span class="Apple-converted-space"> Unchanged 琛岀殑榛樿琛岀増鏈槸Current銆?strong>Deleted 琛岀殑榛樿琛岀増鏈槸 Original銆?strong>Detached 琛岀殑榛樿琛岀増鏈槸 Proposed銆?/td>
Original 琛岀殑鍘熷鍊箋傚鏋滄槸鏈?span class="Apple-converted-space"> Added 鐨?span class="Apple-converted-space"> RowState 鐨勮錛屽垯涓嶅瓨鍦ㄦ琛岀増鏈?/td>
Proposed 琛岀殑寤鴻鍊箋傚湪瀵硅榪涜緙栬緫鎿嶄綔鏈熼棿錛屾垨瀵逛簬涓嶅睘浜?span class="Apple-converted-space"> DataRowCollection 鐨勮錛屽瓨鍦ㄦ琛岀増鏈?/td>

閫氳繃璋冪敤 HasVersion 鏂規(guī)硶騫跺皢 DataRowVersion 浣滀負(fù)鍙傛暟浼犻掞紝鎮(zhèn)ㄥ彲浠ユ祴璇?span class="Apple-converted-space"> DataRow 鏄惁鍏鋒湁鐗瑰畾鐨勮鐗堟湰銆備緥濡傦紝鍦ㄨ皟鐢?span class="Apple-converted-space"> AcceptChanges 涔嬪墠錛?code class="ce">DataRow.HasVersion(DataRowVersion.Original) 瀵規(guī)柊娣誨姞鐨勮灝嗚繑鍥?span class="Apple-converted-space"> false銆?/p>

渚嬪錛屼互涓嬩唬鐮佺ず渚嬫樉紺轟簡琛ㄤ腑鎵鏈夊凡鍒犻櫎琛岀殑鍊箋傚凡鍒犻櫎鐨勮娌℃湁 Current 琛岀増鏈紝鍥犳鍦ㄨ闂垪鍊兼椂蹇呴』浼犻?span class="Apple-converted-space"> DataRowVersion.Original銆?/p>

DataTable catTable = catDS.Tables["Categories"];

DataRow[] delRows = catTable.Select(null, null, DataViewRowState.Deleted);

Console.WriteLine("Deleted rows:/n");

foreach (DataColumn catCol in catTable.Columns)
  Console.Write(catCol.ColumnName + "/t");
Console.WriteLine();

foreach (DataRow delRow in delRows)
{
  foreach (DataColumn catCol in catTable.Columns)
    Console.Write(delRow[catCol, DataRowVersion.Original] + "/t");
  Console.WriteLine();
}

浠庤〃涓垹闄よ:璇存槑濡備綍浠庤〃涓Щ闄よ銆?/p>
鐢ㄤ簬浠?span class="Apple-converted-space"> DataTable 瀵硅薄涓垹闄?span class="Apple-converted-space"> DataRow 瀵硅薄鐨勬柟娉曟湁涓ょ錛?strong>DataRowCollection 瀵硅薄鐨?span class="Apple-converted-space"> Remove 鏂規(guī)硶鍜?strong>DataRow 瀵硅薄鐨?span class="Apple-converted-space"> Delete 鏂規(guī)硶銆?strong>Remove 鏂規(guī)硶浠?span class="Apple-converted-space"> DataRowCollection 涓垹闄?span class="Apple-converted-space"> DataRow錛岃?span class="Apple-converted-space"> Delete 鏂規(guī)硶鍙皢琛屾爣璁頒負(fù)鍒犻櫎銆傚綋搴旂敤紼嬪簭璋冪敤 AcceptChanges 鏂規(guī)硶鏃訛紝鎵嶄細(xì)鍙戠敓瀹為檯鐨勫垹闄ゃ傞氳繃浣跨敤 Delete錛屾?zhèn)ㄥ彲浠ュ湪瀹為檯鍒犻櫎涔嬪墠鍏堜互缂柦E嬫柟寮忔鏌ュ摢浜涜鏍囪涓哄垹闄ゃ傚鏋滃皢琛屾爣璁頒負(fù)鍒犻櫎錛屽叾 RowState 灞炴т細(xì)璁劇疆涓?span class="Apple-converted-space"> Deleted銆?

鍦ㄥ皢 DataSet 鎴?span class="Apple-converted-space"> DataTable 涓?span class="Apple-converted-space"> DataAdapter 鍜屽叧緋誨瀷鏁版嵁婧愪竴璧蜂嬌鐢ㄦ椂錛岀敤 DataRow 鐨?span class="Apple-converted-space"> Delete 鏂規(guī)硶縐婚櫎琛屻?strong>Delete 鏂規(guī)硶鍙槸鍦?span class="Apple-converted-space"> DataSet 鎴?span class="Apple-converted-space"> DataTable 涓皢琛屾爣璁頒負(fù) Deleted錛岃屼笉浼?xì)绉婚櫎瀹冦傝?span class="Apple-converted-space"> DataAdapter 鍦ㄩ亣鍒版爣璁頒負(fù) Deleted 鐨勮鏃訛紝浼?xì)鎵ц鍏?span id="vlvfbnl" class="Apple-converted-space"> DeleteCommand 浠ュ湪鏁版嵁婧愪腑鍒犻櫎璇ヨ銆傜劧鍚庯紝灝卞彲浠ョ敤AcceptChanges 鏂規(guī)硶姘鎬箙縐婚櫎璇ヨ銆傚鏋滀嬌鐢?span class="Apple-converted-space"> Remove 鍒犻櫎璇ヨ錛屽垯璇ヨ灝嗕粠琛ㄤ腑瀹屽叏縐婚櫎錛屼絾DataAdapter 涓嶄細(xì)鍦ㄦ暟鎹簮涓垹闄よ琛屻?/p>

DataRowCollection 鐨?span class="Apple-converted-space"> Remove 鏂規(guī)硶閲囩敤 DataRow 浣滀負(fù)鍙傛暟錛屽茍灝嗗叾浠庨泦鍚堜腑縐婚櫎錛屽涓嬩緥鎵紺恒?/p>

workTable.Rows.Remove(workRow);

浣滀負(fù)瀵規(guī)瘮錛屼互涓嬬ず渚嬫紨紺轟簡濡備綍璋冪敤 DataRow 涓婄殑 Delete 鏂規(guī)硶鏉ュ皢鍏?span class="Apple-converted-space"> RowState 鏀逛負(fù) Deleted銆?/p>

workRow.Delete();

濡傛灉灝嗚鏍囪涓哄垹闄わ紝騫朵笖璋冪敤 DataTable 瀵硅薄鐨?span class="Apple-converted-space"> AcceptChanges 鏂規(guī)硶錛岃琛屽氨浼?xì)浠?span id="htplhn3" class="Apple-converted-space"> DataTable 涓Щ闄ゃ傜浉姣斾箣涓嬶紝濡傛灉璋冪敤 RejectChanges錛岃鐨?span class="Apple-converted-space"> RowState 灝變細(xì)鎭㈠鍒拌鏍囪涓?span class="Apple-converted-space"> Deleted 涔嬪墠鐨勭姸鎬併?/p>

娉ㄦ剰 濡傛灉 DataRow 鐨?span class="Apple-converted-space"> RowState 鏄?span class="Apple-converted-space"> Added錛屽垯鎰忓懗鐫宸插皢鍏舵坊鑷寵〃涓紝鐒跺悗灝嗗叾鏍囪涓?strong>Deleted錛屼粠琛ㄤ腑縐婚櫎銆?/blockquote>

娣誨姞鍜岃鍙栬閿欒淇℃伅:璇存槑濡備綍鎸夎鎻掑叆閿欒淇℃伅錛屼互鐢ㄤ簬瑙e喅鏈夊叧搴旂敤紼嬪簭鍐呰涓暟鎹殑闂銆?/p>
涓轟簡閬垮厤鍦ㄧ紪杈?span class="Apple-converted-space"> DataTable 涓殑鍊兼椂姣忔鍙戠敓琛岄敊璇兘蹇呴』鍝嶅簲錛屽彲灝嗛敊璇俊鎭坊鑷寵涓紝浠ヤ究浠ュ悗浣跨敤銆?strong>DataRow 瀵硅薄閫氳繃瀵瑰悇琛屾彁渚?span class="Apple-converted-space"> RowError 灞炴ф潵鏀寔姝ゅ姛鑳姐傚皢鏁版嵁娣昏嚦 DataRow 鐨?span class="Apple-converted-space"> RowError 灞炴т細(xì)灝?strong>DataRow 鐨?span class="Apple-converted-space"> HasErrors 灞炴ф爣璁頒負(fù) true銆傚鏋?span class="Apple-converted-space"> DataRow 鏄?span class="Apple-converted-space"> DataTable 鐨勭粍鎴愰儴鍒嗭紝涓?span class="Apple-converted-space"> DataRow.HasErrors鏄?span class="Apple-converted-space"> true錛屽垯 DataTable.HasErrors 灞炴т篃鏄?span class="Apple-converted-space"> true銆傝繖涔熼傜敤浜?span class="Apple-converted-space"> DataTable 鎵灞炵殑 DataSet銆備負(fù)閿欒鍋氭祴璇曟椂錛屽彲浠ユ鏌?span class="Apple-converted-space"> HasErrors 灞炴т互紜畾閿欒淇℃伅鏄惁宸叉坊鑷蟲墍鏈夎銆傚鏋?span class="Apple-converted-space"> HasErrors 涓?span class="Apple-converted-space"> true錛屽垯鍙嬌鐢?span class="Apple-converted-space"> DataTable 鐨?strong>GetErrors 鏂規(guī)硶浠ヤ究鍙繑鍥炲拰媯(gè)鏌ユ湁閿欒鐨勮錛屽涓嬩緥鎵紺恒?

DataTable  workTable = new DataTable("Customers");
workTable.Columns.Add("CustID", typeof(Int32));
workTable.Columns.Add("Total", typeof(Double));

workTable.RowChanged += new DataRowChangeEventHandler(OnRowChanged);

for (int i = 0; i < 10; i++)
  workTable.Rows.Add(new Object[] {i, i*100});

if (workTable.HasErrors)
{
  Console.WriteLine("Errors In Table " + workTable.TableName);

  foreach (DataRow myRow in workTable.GetErrors())
  {
    Console.WriteLine("CustID = " + myRow["CustID"]);
    Console.WriteLine(" Error = " + myRow.RowError + "/n");
  }
}

protected static void OnRowChanged(Object sender, DataRowChangeEventArgs args)
{
  // Check for zero values.
  if (args.Row["Total"].Equals(0D))
    args.Row.RowError = "Total cannot be 0.";
}

鎺ュ彈鎴栨嫆緇濆琛岀殑鏇存敼:璇存槑濡備綍鎺ュ彈鎴栨嫆緇濆琛岀殑鏇存敼銆?/p>
鍦ㄦ楠岃繃瀵?span class="Apple-converted-space"> DataTable 涓殑鏁版嵁鎵鍋氭洿鏀圭殑鍑嗙‘鎬т箣鍚庯紝鍙嬌鐢?span class="Apple-converted-space"> DataRow銆?strong>DataTable 鎴?span class="Apple-converted-space"> DataSet 鐨?strong>AcceptChanges 鏂規(guī)硶鏉ユ帴鍙楁洿鏀癸紝姝ゆ柟娉曚細(xì)灝?span class="Apple-converted-space"> Current 琛屽艱緗負(fù) Original 鍊鹼紝騫朵細(xì)灝?span class="Apple-converted-space"> RowState 灞炴ц緗負(fù) Unchanged銆傛帴鍙楁垨鎷掔粷鏇存敼浼?xì)娓呴櫎鎵鏈?span class="Apple-converted-space"> RowError 淇℃伅錛屽茍灝?span class="Apple-converted-space"> HasErrors 灞炴ц緗負(fù) false銆傛帴鍙楁垨鎷掔粷鏇存敼榪樺彲浠ュ獎(jiǎng)鍝嶅湪鏁版嵁婧愪腑鏇存柊鏁版嵁銆傛湁鍏蟲洿澶氫俊鎭紝璇峰弬闃?a style="color: rgb(51,102,153); text-decoration: none" >浣跨敤 DataAdapter 鍜?DataSet 鏇存柊鏁版嵁搴?/a>銆?

濡傛灉 DataTable 涓婂瓨鍦ㄥ閿害鏉燂紝浣跨敤 AcceptChanges 鍜?span class="Apple-converted-space"> RejectChanges 鎺ュ彈鎴栨嫆緇濈殑鏇存敼灝變細(xì)鏍規(guī)嵁ForeignKeyConstraint.AcceptRejectRule 浼犳挱鑷?span class="Apple-converted-space"> DataRow 鐨勫瓙琛屻?/p>

浠ヤ笅紺轟緥媯(gè)鏌ユ湁閿欒鐨勮錛屽湪閫傜敤涔嬪瑙e喅閿欒錛屾嫆緇濇棤娉曡В鍐抽敊璇殑琛屻傝娉ㄦ剰錛屽浜庤В鍐崇殑閿欒錛?strong>RowError鍊間細(xì)閲嶇疆涓虹┖瀛楃涓詫紝瀵艱嚧灝?span class="Apple-converted-space"> HasErrors 灞炴ц緗負(fù) false銆傚綋瑙e喅鎴栨嫆緇濅簡鎵鏈夌殑鏈夐敊璇殑琛屾椂錛屽氨浼?xì)璋冪?strong>AcceptChanges 鏉ユ帴鍙楀鏁翠釜 DataTable 鐨勬墍鏈夋洿鏀廣?/p>

if (workTable.HasErrors)
{

  foreach (DataRow errRow in workTable.GetErrors())
  {
    if (errRow.RowError == "Total cannot exceed 1000.")
    {
      errRow["Total"] = 1000;
      errRow.RowError = "";    // Clear the error.
    }
    else
      errRow.RejectChanges();
  }
}

workTable.AcceptChanges();

澶勭悊 DataTable 浜嬩歡:鎻愪緵鍙敤浜?span class="Apple-converted-space"> DataTable 鐨勪簨浠剁殑鐩稿叧淇℃伅錛屽寘鎷慨鏀瑰垪鍊煎拰娣誨姞鎴栧垹闄よ鏃剁殑浜嬩歡銆?/p>
DataTable 瀵硅薄鎻愪緵涓緋誨垪鍙敱搴旂敤紼嬪簭澶勭悊鐨勪簨浠躲備笅琛ㄨ鏄庝簡 DataTable 浜嬩歡銆?
浜嬩歡 璇存槑
ColumnChanged 鍦ㄥ煎凡鎴愬姛鎻掑叆鍒楁椂鍙戠敓銆?/td>
ColumnChanging 鍦ㄥ凡鎻愪氦鍒楀兼椂鍙戠敓銆?/td>
RowChanged 鍦ㄥ凡鎴愬姛緙栬緫琛ㄤ腑鐨勮鍚庡彂鐢熴?/td>
RowChanging 褰撴鍦ㄦ洿鏀硅〃涓殑琛屾椂鍙戠敓銆?/td>
RowDeleted 鍦ㄨ〃涓殑鏌愯宸茶鏍囪涓?span class="Apple-converted-space"> Deleted 涔嬪悗鍙戠敓銆?/td>
RowDeleting 鍦ㄨ〃涓殑鏌愯琚爣璁頒負(fù) Deleted 涔嬪墠鍙戠敓銆?/td>

浠ヤ笅紺轟緥鍒涘緩 4 涓簨浠訛細(xì)OnColumnChanged銆?strong>OnColumnChanging銆?strong>OnRowChanged 鍜?strong>OnRowChanging銆傝繖浜涗簨浠朵腑鐨勬瘡涓涓兘鍦ㄥ垪鎴栬鏇存敼鏃跺彂鐢熴?/p>

workTable.ColumnChanged  += new DataColumnChangeEventHandler(OnColumnChanged);
workTable.ColumnChanging += new DataColumnChangeEventHandler(OnColumnChanging);
workTable.RowChanged     += new DataRowChangeEventHandler(OnRowChanged);
workTable.RowChanging    += new DataRowChangeEventHandler(OnRowChanging);

protected static void OnColumnChanged(object sender, DataColumnChangeEventArgs args)
{
  Console.Write(" ColumnChanged: ");
  Console.Write(args.Column.ColumnName + " changed to '" + args.ProposedValue + "'/n");
}

protected static void OnColumnChanging(object sender, DataColumnChangeEventArgs args)
{
  Console.Write("ColumnChanging: ");
  Console.Write(args.Column.ColumnName + " equals '" + args.Row[args.Column] + 
                    "', changing to '" + args.ProposedValue + "'/n");    
}

protected static void OnRowChanging(object sender, DataRowChangeEventArgs args)
{
  if (args.Action != DataRowAction.Nothing)
    Console.WriteLine("   RowChanging: Action = " + args.Action + ", CustID = " + args.Row["CustID"]);
}

protected static void OnRowChanged(object sender, DataRowChangeEventArgs args)
{
  if (args.Action != DataRowAction.Nothing)
    Console.WriteLine("    RowChanged: Action = " + args.Action + ", CustID = " + args.Row["CustID"]);
}



Ke 2014-06-30 11:08 鍙戣〃璇勮
]]>
SQL Server 2000 Split 鑷畾涔夊嚱鏁?/title><link>http://www.tkk7.com/keweibo/articles/406147.html</link><dc:creator>Ke</dc:creator><author>Ke</author><pubDate>Fri, 08 Nov 2013 08:57:00 GMT</pubDate><guid>http://www.tkk7.com/keweibo/articles/406147.html</guid><wfw:comment>http://www.tkk7.com/keweibo/comments/406147.html</wfw:comment><comments>http://www.tkk7.com/keweibo/articles/406147.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/keweibo/comments/commentRss/406147.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/keweibo/services/trackbacks/406147.html</trackback:ping><description><![CDATA[<div>/****** Object: Function [dbo].[F_SQLSERVER_SPLIT]   Script Date: 2013-10-30 16:21:46 ******/</div><div>USE [ZBP];</div><div>GO</div><div>SET ANSI_NULLS OFF;</div><div>GO</div><div>SET QUOTED_IDENTIFIER ON;</div><div>GO</div><div>CREATE FUNCTION [dbo].[F_SQLSERVER_SPLIT](@Long_str varchar(8000),@split_str varchar(100))    </div><div>RETURNS  @tmp TABLE(        </div><div>    ID          inT     IDENTITY PRIMARY KEY,      </div><div>    short_str   varchar(8000)    </div><div>)    </div><div>AS   </div><div>BEGIN   </div><div>    DECLARE @long_str_Tmp varchar(8000),@short_str varchar(8000),@split_str_length int   </div><div>    SET @split_str_length = LEN(@split_str)    </div><div>    IF CHARINDEX(@split_str,@Long_str)=1 </div><div>         SET @long_str_Tmp=SUBSTRING(@Long_str,@split_str_length+1,LEN(@Long_str)-@split_str_length)</div><div>    ELSE</div><div>         SET @long_str_Tmp=@Long_str</div><div>    IF CHARINDEX(REVERSE(@split_str),REVERSE(@long_str_Tmp))>1    </div><div>        SET @long_str_Tmp=@long_str_Tmp+@split_str    </div><div>    ELSE   </div><div>        SET @long_str_Tmp=@long_str_Tmp    </div><div>    IF CHARINDEX(@split_str,@long_str_Tmp)=0</div><div>        Insert INTO @tmp select @long_str_Tmp </div><div>    ELSE</div><div>        BEGIN</div><div>            WHILE CHARINDEX(@split_str,@long_str_Tmp)>0    </div><div>                BEGIN   </div><div>                    SET @short_str=SUBSTRING(@long_str_Tmp,1,CHARINDEX(@split_str,@long_str_Tmp)-1)    </div><div>                    DECLARE @long_str_Tmp_LEN INT,@split_str_Position_END int   </div><div>                    SET @long_str_Tmp_LEN = LEN(@long_str_Tmp)    </div><div>                    SET @split_str_Position_END = LEN(@short_str)+@split_str_length    </div><div>                    SET @long_str_Tmp=REVERSE(SUBSTRING(REVERSE(@long_str_Tmp),1,@long_str_Tmp_LEN-@split_str_Position_END))</div><div>                    IF @short_str<>'' Insert INTO @tmp select @short_str    </div><div>                END           </div><div>        END</div><div>    RETURN     </div><div>END</div><div>GO</div><div></div><img src ="http://www.tkk7.com/keweibo/aggbug/406147.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/keweibo/" target="_blank">Ke</a> 2013-11-08 16:57 <a href="http://www.tkk7.com/keweibo/articles/406147.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>SQL Server 2000 鍗佸叚榪涘埗涓庡崄榪涘埗浜掕漿錛堟敹钘忥級(jí)http://www.tkk7.com/keweibo/articles/406146.htmlKeKeFri, 08 Nov 2013 08:54:00 GMThttp://www.tkk7.com/keweibo/articles/406146.htmlhttp://www.tkk7.com/keweibo/comments/406146.htmlhttp://www.tkk7.com/keweibo/articles/406146.html#Feedback0http://www.tkk7.com/keweibo/comments/commentRss/406146.htmlhttp://www.tkk7.com/keweibo/services/trackbacks/406146.html鍗佽繘鍒惰漿鍗佸叚榪涘埗
/****** Object: Function [dbo].[IntToHex]   Script Date: 2013-10-30 16:22:15 ******/
USE [ZBP];
GO
SET ANSI_NULLS OFF;
GO
SET QUOTED_IDENTIFIER ON;
GO
CREATE FUNCTION [dbo].[IntToHex]
(@IntNum bigint)
RETURNS varchar(16)
AS
BEGIN
declare @Mods bigint, @res varchar(16)
set @res=''
while @IntNum <> 0
begin
set @Mods = @IntNum % 16
if @Mods > 9
set @res = Char(Ascii('A')+@Mods-10)+@res
else
set @res = Cast(@Mods as varchar(4))+@res
set @IntNum = @IntNum/16
end
return @res
END
GO
鍗佸叚榪涘埗杞崄榪涘埗
/****** Object: Function [dbo].[HexToInt]   Script Date: 2013-10-30 16:22:04 ******/
USE [ZBP];
GO
SET ANSI_NULLS OFF;
GO
SET QUOTED_IDENTIFIER ON;
GO
CREATE FUNCTION [dbo].[HexToInt]
(@hex varchar(100))
RETURNS int
AS
BEGIN
Declare @result bigint,@iPos int,@iTmp bigint,@iLoop int,@tmp varchar(16)
    Set @tmp = '0123456789ABCDEF'
    Select @result = 0,@iPos = 0
    While @iPos <   Len(@hex)
    Begin
          Set  @iTmp = 
               CharIndex(substring(@hex,Len(@hex) - @iPos,1),@tmp)-1
          Set @iLoop = 1
          While @iLoop <= @iPos and @iTmp > 0
          begin
              Set @iTmp = @iTmp * 16
              Set @iLoop = @iLoop + 1
          end
          Set @result = @result + @iTmp
          Set @iLoop = @iLoop + 1     
          Set @iPos = @iPos + 1
    End
    return @result
END
GO


Ke 2013-11-08 16:54 鍙戣〃璇勮
]]>
瀛樺偍榪囩▼閫掑綊璋冪敤鏃?娓告爣鐨勪嬌鐢ㄦ敞鎰忎簨欏?http://www.tkk7.com/keweibo/articles/399268.htmlKeKeTue, 14 May 2013 09:17:00 GMThttp://www.tkk7.com/keweibo/articles/399268.htmlhttp://www.tkk7.com/keweibo/comments/399268.htmlhttp://www.tkk7.com/keweibo/articles/399268.html#Feedback0http://www.tkk7.com/keweibo/comments/commentRss/399268.htmlhttp://www.tkk7.com/keweibo/services/trackbacks/399268.html娉ㄦ剰錛?/span>蹇呴』鎶婃父鏍囧0鏄庝負(fù)灞閮ㄧ殑錛屽嵆鍔犱笂local

CREATE PROCEDURE [dbo].[p_expand_k3_bom]
@p_itemID int, @p_levelID int
WITH EXEC AS CALLER
AS
declare @v_itemID int
declare @v_levelID int
declare @v_itemNO varchar(20)
declare @v_itemName varchar(200)
declare @v_itemModel varchar(200)
declare @v_note1 varchar(20)
declare cursor_bom CURSOR LOCAL FOR select b.FItemID,c.FShortNumber, c.FName, c.FModel,  b.FNote1
  from AIS20120110144135.dbo.ICBOM a, AIS20120110144135.dbo.ICBOMChild b, AIS20120110144135.dbo.t_ICItem c
  where a.FInterID = b.FInterID
  and b.FItemID = c.FItemID
  and a.FInterID = (select top 1 FInterID from AIS20120110144135.dbo.ICBOM where FItemID = @p_itemID)
  and a.FItemID = @p_itemID
set @v_levelID = @p_levelID+1
open cursor_bom 
fetch next from cursor_bom into @v_itemID, @v_itemNO, @v_itemName, @v_itemModel, @v_note1
while (@@FETCH_STATUS = 0)
  begin
    INSERT INTO k3_bom_info
      (level_id, item_id, item_no, item_name, item_model, note_1) 
    VALUES (@v_levelID, @v_itemID, @v_itemNO, @v_itemName, @v_itemModel, @v_note1)
    
    exec p_expand_k3_bom @v_itemID, @v_levelID
    
    fetch next from cursor_bom into @v_itemID, @v_itemNO, @v_itemName, @v_itemModel, @v_note1
  end
close cursor_bom
deallocate cursor_bom
GO


Ke 2013-05-14 17:17 鍙戣〃璇勮
]]>
Openbravo Developers_Guide Noteshttp://www.tkk7.com/keweibo/articles/398701.htmlKeKeFri, 03 May 2013 01:23:00 GMThttp://www.tkk7.com/keweibo/articles/398701.htmlhttp://www.tkk7.com/keweibo/comments/398701.htmlhttp://www.tkk7.com/keweibo/articles/398701.html#Feedback0http://www.tkk7.com/keweibo/comments/commentRss/398701.htmlhttp://www.tkk7.com/keweibo/services/trackbacks/398701.htmlHow to create a Table
http://wiki.openbravo.com/wiki/How_to_create_a_Table

The new table must include the AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated and UpdatedBy fields that are mandatory and required for security and auditory purposes of the application. 

Each table must have at least one column marked as an identifier. The actual values of identifier columns later get concatenated to be shown to the user as a representation of a particular record (see the link to the Sales Order within the Sales Invoice window). These identifiers will also be used to construct dropdown lists of records of that particular table. By default all columns with column name Name are set as an identifier. In case there is no column with this Name, no identifier is set and needs to be done so manually or compilation will fail. 

NOTE: The columns that are named line or seqNo are used to contain the sequence number of a record (i.e. the number of a line in an invoice). They take a default value like:

@SQL=SELECT COALESCE(MAX(ColumnName),0)+10 AS DefaultValue FROM TableName WHERE xxParentColumn=@xxParentColumn@

The WHERE part of this clause needs to be replaced with the required values. The code that should appear here is the name of the column which links with the id of the parent one. For example, each record of the C_InvoiceLine belongs to a particular C_Invoice record and they are all sequenced. C_Invoice is the parent table for the lines saved in C_InvoiceLine. This table has a column named line and the default value that it takes is:

@SQL=SELECT COALESCE(MAX(LINE),0)+10 AS DefaultValue FROM C_INVOICELINE WHERE C_INVOICE_ID=@C_INVOICE_ID@

How to add Columns to a Table

http://wiki.openbravo.com/wiki/How_to_add_Columns_to_a_Table


These changes can be done in two different locations:

  1. Add columns to the original module (dbprefix HT)
  2. Create a second module (dbprefix HT2) which adds the columns to the first module

The first option can be chosen if the original module author wants to add more columns to his/her module. The second option is possible for anyone as the columns are added by a new module to the existing one which is not changed directly.

The main difference between these two methods is the names which need to be chosen for the columns to comply with the modularity naming rules.

  1. Adding column to same module: Any valid column name can be picked
  2. Via second module: New column name must comply to the pattern EM_<DBPREFIX>_ where <DBPREFIX> must be the dbprefix if the new module contaning the column to be added. In this example: EM_HT2_

How to add a Constraint

http://wiki.openbravo.com/wiki/How_to_add_a_Constraint

In the Application Dictionary || Message window create a new record using the following details:

  • Module Openbravo Howtos 2 as this is the module containing the constraint also.
  • Search key: The search key must be exactly the same as the constraint's one, in this case em_ht2_ht_salary_dates_chk as this is the link between the constraint and the message.
  • Message type: Depending on the type the UI for the message box will be different (green for success, yellow for warning...), in our case we want a red error message box, so we select Error.
  • Message text: It is the user friendly message that will be displayed inside the message box. So let's enter: The Valid To date may not be before the Valid From date

 

 Creating a new instance of a Business Object

http://wiki.openbravo.com/wiki/How_to_work_with_the_Data_Access_Layer#A_.27Hello_World.27_Example

A business object may never be created using the Java new operator. All business objects should be created using the OBProvider factory class:

   // create the object through the factory   final Category bpg = OBProvider.getInstance().get(Category.class);

Hibernate will detect that a business object is new when:

  • the id of the business object is not set
  • when the flag newOBObject is set to true explicitly

So if you want to create a new business object with a specific id (by calling setId(...)) then you explicitly need to call businessObject.setNewOBObject(true). Otherwise, Hibernate will throw an exception ('count of batch update operation....'). 




Ke 2013-05-03 09:23 鍙戣〃璇勮
]]>
redhat 9.0,鎻愮ずDetermining IP information for eth0... failed; no link present. Check cable?http://www.tkk7.com/keweibo/articles/398679.htmlKeKeThu, 02 May 2013 08:27:00 GMThttp://www.tkk7.com/keweibo/articles/398679.htmlhttp://www.tkk7.com/keweibo/comments/398679.htmlhttp://www.tkk7.com/keweibo/articles/398679.html#Feedback0http://www.tkk7.com/keweibo/comments/commentRss/398679.htmlhttp://www.tkk7.com/keweibo/services/trackbacks/398679.htmlredhat 9.0,鎻愮ずDetermining IP information for eth0... failed; no link present. Check cable?鏃犳硶嬋媧葷綉緇滆澶噀th0
鎴戞悳鐨勭浉鍏寵В鍐蟲柟妗堜負(fù)錛?nbsp;
鍒?etc/sysconfig/network-scripts/ifcfg-eth 
/etc/sysconfig/networking/devices/ifcfg-eth 鍏朵腑琛ㄧずEthernet adapter鐨勬爣璇嗘暟瀛楋紝涓鑸負(fù)0銆傚綋涓洪浂鐨勬椂鍊欙紝灝辨槸 
/etc/sysconfig/network-scripts/ifcfg-eth0 
/etc/sysconfig/networking/devices/ifcfg-eth0 榪欎袱涓枃浠朵腑鍔犲叆 

check_link_down () { 
return 1; 


Ke 2013-05-02 16:27 鍙戣〃璇勮
]]>
鍏蜂綋鍒嗘瀽tftp server閰嶇疆鐨勬楠?杞?http://www.tkk7.com/keweibo/articles/398387.htmlKeKeThu, 25 Apr 2013 06:57:00 GMThttp://www.tkk7.com/keweibo/articles/398387.htmlhttp://www.tkk7.com/keweibo/comments/398387.htmlhttp://www.tkk7.com/keweibo/articles/398387.html#Feedback0http://www.tkk7.com/keweibo/comments/commentRss/398387.htmlhttp://www.tkk7.com/keweibo/services/trackbacks/398387.html杞嚜錛?a >http://network.51cto.com/art/201009/225534.htm

鍦↙inux緋葷粺涓紝鎴戜滑渚濈劧鍙互榪涜tftp server閰嶇疆鐨勬搷浣溿傚彲鑳藉浜庣啛鎮(zhèn)夌獥鍙f搷浣滅殑鏈嬪弸錛屽浜庡懡浠ゆ搷浣滄湁浜涗笉鐔熸?zhèn)夊Q屾病鍏崇郴榪欓噷鎴戜滑灝辨潵璁茶В涓涓婰inux 涓嬬殑tftp-server閰嶇疆鐨勫懡浠ゆ搷浣溿俆FTP鏄敤鏉ヤ笅杞借繙紼嬫枃浠剁殑鏈綆鍗曠綉緇滃崗璁?瀹冨叾浜嶶DP鍗忚鑰屽疄鐜?宓屽叆寮弆inux鐨則ftp寮鍙戠幆澧冨寘鎷袱涓柟闈?

涓鏄痩inux鏈嶅姟鍣ㄧ鐨則ftp-server鏀寔,

浜屾槸宓屽叆寮忕洰鏍囩郴緇熺殑tftp-client鏀寔.

鍥犱負(fù)u-boot鏈韓鍐呯疆鏀寔tftp-client,鎵浠ュ祵鍏ュ紡鐩爣緋葷粺绔氨涓嶇敤閰嶇疆浜?

涓嬮潰灝辮緇嗕粙緇嶄竴涓媗inux鏈嶅姟鍣ㄧtftp server閰嶇疆.鍦╮edhat 9.0鐨勭涓夊紶鍏夌洏涓?鏈塼ftp-server鐨勫畨瑁卹pm鍖?錛?錛?nbsp;      瀹夎

#mount –t iso9660 /dev/hdc /mnt/cdrom    //鎸傝澆鍏夌洏

#rpm -ivh tftp-server-0.32-4.i386.rpm              //瀹夎

#umount /mnt/cdrom                                          //鍗歌澆鍏夌洏

錛?錛変慨鏀規(guī)枃浠跺湪linux涓?涓嶇浣跨敤鐨勬槸鍝竴縐峴uper-server,inetd鎴栬厁inetd,榛樿鎯呭喌涓婽FTP鏈嶅姟鏄鐢ㄧ殑,鎵浠ヨ淇敼鏂囦歡鏉ュ紑鍚湇鍔?

鏍規(guī)嵁錛?錛夌殑瀹夎鏂規(guī)硶,鍙互淇敼鏂囦歡/etc/xinetd.d/tftp.涓昏鏄緗甌FTP鏈嶅姟鍣ㄧ殑鏍圭洰褰?寮鍚湇鍔?

淇敼鍚庣殑鏂囦歡濡備笅:

service tftp {

socket_type            =dgram

protocol                  =udp

wait                        =yes

user                        =root

server                     =/usr/sbin/in.tftpd

server_args             =-s /home/app -c

disable                    =no

per_source             =11

cps                         =100 2

flags                       =IPv4

}

璇存槑:淇敼欏箂erver_args= -s     <path>    -c,鍏朵腑<path>澶勫彲浠ユ敼涓轟綘鐨則ftp server閰嶇疆鐨勬牴鐩綍,鍙傛暟-s鎸囧畾chroot,-c鎸囧畾浜嗗彲浠ュ垱寤烘枃浠?

錛?錛夊垱寤簍ftp鏍圭洰褰?鍏抽棴闃茬伀澧?鍚姩tftp-server.

#mkdir /home/app

#chmod o+w       /home/app

#/etc/init.d/iptables stop        //鍏抽棴闃茬伀澧?/p>

#service xinetd restart          //閲嶅惎 xinetd 鏈嶅姟

閲嶅惎xinetd鏈嶅姟,鍥犱負(fù)TFTP鏈嶅姟鍙楁帶涓巟inetd, xinetd鏄鏈嶅姟鐨勬湇鍔?瀹冩槸涓嶅紑绔彛鐨?

楠岃瘉涓涓婽FTP鏄惁璧鋒潵浜?

# netstat -nlp

Active Internet connections (only servers)

Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name

tcp 0 0 0.0.0.0:32768 0.0.0.0:* LISTEN 3122/rpc.statd

tcp 0 0 127.0.0.1:32781 0.0.0.0:* LISTEN 4035/xinetd

tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 3103/portmap

tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 3324/httpd

tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 3255/sshd

tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 3213/cupsd

tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 3295/sendmail: acce

tcp 0 0 127.0.0.1:6010 0.0.0.0:* LISTEN 3415/0

tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN 3324/httpd

udp 0 0 0.0.0.0:32768 0.0.0.0:* 3122/rpc.statd

udp 0 0 0.0.0.0:69 0.0.0.0:* 4035/xinetd   ;

鍙互鐪嬪埌69绔彛宸茬粡鎵撳紑

udp 0 0 0.0.0.0:69 0.0.0.0:* 4012/in.tftpd

udp 0 0 0.0.0.0:111 0.0.0.0:* 3103/portmap

udp 0 0 0.0.0.0:754 0.0.0.0:* 3122/rpc.statd

udp 0 0 0.0.0.0:631 0.0.0.0:* 3213/cupsd

榪欐牱,tftp server閰嶇疆鐨勫惎鍔ㄦ楠ゅ氨瀹屾垚浜嗐?/p>

浣犲彲浠ョ櫥闄嗘湰鏈烘祴璇曚互涓?鍛戒護(hù)濡備笅:

#tftp     your-ip-address

tftp>get <download file>

tftp>put <upload file>

tftp>q



Ke 2013-04-25 14:57 鍙戣〃璇勮
]]>
VC錛歯afxcwd.lib(dllmodul.obj) : error LNK2005: _DllMain@12..."閿欒! 錛堣漿錛?/title><link>http://www.tkk7.com/keweibo/articles/396482.html</link><dc:creator>Ke</dc:creator><author>Ke</author><pubDate>Fri, 15 Mar 2013 07:04:00 GMT</pubDate><guid>http://www.tkk7.com/keweibo/articles/396482.html</guid><wfw:comment>http://www.tkk7.com/keweibo/comments/396482.html</wfw:comment><comments>http://www.tkk7.com/keweibo/articles/396482.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/keweibo/comments/commentRss/396482.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/keweibo/services/trackbacks/396482.html</trackback:ping><description><![CDATA[<div>鏈嬪弸緙栧啓涓涓猟ll,緙栬瘧鏃舵誨嚭鐜?/div> <div>"nafxcwd.lib(dllmodul.obj) : error LNK2005: _DllMain@12..."閿欒!</div> <div>鍚庡彂鐜版槸,<span style="color: red"><strong>鍏跺垱寤篸ll鏃墮夋嫨鐨勬椂涓嶄嬌鐢∕FC,鑰屽悗鏉ュ伐紼嬩腑鍙堟坊鍔犱簡涓嶮FC鐩稿叧鐨勪笢瑗?/strong></span>.鎵嶅紩璧蜂笂榪伴棶棰?</div> <div>閲囩敤濡備笅姝ラ瑙e喅姝ら棶棰?</div> <div>1.灝嗗伐紼嬭緗腑鏀逛負(fù)"鍔ㄦ佷嬌鐢∕FC"</div> <div>2.<strong>鍒癈++璁劇疆欏典腑,鐪嬪埌Preprocessor Definitions緙栬緫妗嗕腑鍚屾椂瀛樺湪_USRDLL鍜宊AFXDLL, 鍒犻櫎_USRDLL鍗沖彲</strong>.<br /><br />杞嚜錛?a >http://blog.csdn.net/train_z/article/details/3118754</a><br /><br />紜瑙e喅浜嗛棶棰橈紝浣嗘楠?錛屾垜浣跨敤鐨勬槸“闈欐丮FC”</div><img src ="http://www.tkk7.com/keweibo/aggbug/396482.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/keweibo/" target="_blank">Ke</a> 2013-03-15 15:04 <a href="http://www.tkk7.com/keweibo/articles/396482.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>VC: 鈥淟oadLibraryW鈥? 涓嶈兘灝嗗弬鏁?1 浠庘渃onst char *鈥濊漿鎹負(fù)鈥淟PCWSTR鈥?/title><link>http://www.tkk7.com/keweibo/articles/396408.html</link><dc:creator>Ke</dc:creator><author>Ke</author><pubDate>Wed, 13 Mar 2013 10:59:00 GMT</pubDate><guid>http://www.tkk7.com/keweibo/articles/396408.html</guid><wfw:comment>http://www.tkk7.com/keweibo/comments/396408.html</wfw:comment><comments>http://www.tkk7.com/keweibo/articles/396408.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/keweibo/comments/commentRss/396408.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/keweibo/services/trackbacks/396408.html</trackback:ping><description><![CDATA[<p>鍔ㄦ佽皟鐢―LL<br />閫氳繃<br />LoadLibrary<br />GetProcAddress<br />FreeLibrary瀹炵幇銆?/p> <p>鍘熷洜 錛氬伐紼嬪彧鏀寔UNICODE瀛楃</p> <p>瑙e喅鏂規(guī)硶錛?/p> <p><strong style="color: red">宸ョ▼灞炴?>閰嶇疆灞炴?#8211;>甯歌—>瀛楃闆?#8212;->浣跨敤澶氬瓧鑺傜瀛楃闆?/strong></p> <p> </p><img src ="http://www.tkk7.com/keweibo/aggbug/396408.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/keweibo/" target="_blank">Ke</a> 2013-03-13 18:59 <a href="http://www.tkk7.com/keweibo/articles/396408.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>c++璋冪敤c#鐨刣ll錛堣漿錛?http://www.tkk7.com/keweibo/articles/396322.htmlKeKeTue, 12 Mar 2013 07:13:00 GMThttp://www.tkk7.com/keweibo/articles/396322.htmlhttp://www.tkk7.com/keweibo/comments/396322.htmlhttp://www.tkk7.com/keweibo/articles/396322.html#Feedback0http://www.tkk7.com/keweibo/comments/commentRss/396322.htmlhttp://www.tkk7.com/keweibo/services/trackbacks/396322.html涓銆佷嬌鐢?clr緙栬瘧MFC鍙墽琛屾枃浠舵垨瑙勫垯C(jī)# DLL鍑芥暟.
    1銆佹墦寮“欏圭洰灞炴?#8221;瀵硅瘽妗嗭紝鏂規(guī)硶鏄彸閿崟鍑?#8220;瑙e喅鏂規(guī)璧勬簮綆$悊鍣?#8221;涓殑欏圭洰騫墮夋嫨“灞炴?#8221;銆?br />    2銆佸睍寮“閰嶇疆灞炴?#8221;鏃佽竟鐨勮妭鐐瑰茍閫夋嫨“甯歌”銆傚湪鍙充晶紿楁牸涓殑“欏圭洰榛樿鍊?#8221;涓嬶紝灝?#8220;鍏叡璇█榪愯搴撴敮鎸?#8221;璁劇疆涓?strong>“鍏叡璇█榪愯搴撴敮鎸侊紙/clr錛?#8221;銆?br />
    3銆佸湪鐩稿悓鐨勭獥鏍間腑錛岀‘淇濆皢“MFC鐨勪嬌鐢?#8221;璁劇疆涓?#8220;鍦ㄥ叡浜獶LL涓嬌鐢∕FC”銆?br />    4銆佸湪“閰嶇疆灞炴?#8221;涓嬶紝灞曞紑“C/C++”鏃佽竟鐨勮妭鐐瑰茍閫夋嫨“甯歌”銆傝紜繚灝?#8220;璋冭瘯淇℃伅鏍煎紡”璁劇疆涓?#8220;紼嬪簭鏁版嵁搴?Zi”錛堣屼笉鏄?#8220;/ZI”錛夈?br />    5銆佸湪“閰嶇疆灞炴?#8221;涓嬶紝閫夋嫨“C/C++”錛岀劧鍚庨夋嫨“浠g爜鐢熸垚”銆傝紜繚灝?#8220;榪愯鏃跺簱”璁劇疆涓?#8220;澶氱嚎紼嬭皟璇旸LL錛?MDd錛?#8221;鎴?#8220;澶氱嚎紼婦LL錛?MD錛?#8221;涔嬩竴銆?br />浜屻佸湪浠g爜寮曠敤闇瑕佺殑dll.
 using <mscorlib.dll>. 
 using "DownloaFiles.dll"   //鎹㈡垚闇瑕佺殑dll鏂囦歡銆?/strong> 
 using namespace System錛?
 using namespace ADMessage_test錛?nbsp; //鎹㈡垚dll涓被鎵浣跨敤鐨刵amespace.
涓夈佸湪C# DLL鍑芥暟璋冪敤浠g爜鍓嶅姞鍏?pragma managed
    榪欐槸manage鍜寀nmanage娣峰悎緙栫▼鍦∕FC涓嬬殑涓縐嶅疄鐜版柟寮忋?br />    浠ヤ笂浠嬬粛C++璋冪敤C# DLL鍑芥暟錛屽笇鏈涘浣犳湁鎵甯姪銆?/p>

鍥?銆佸嚑鐐硅璁頒綇錛?/p>

銆銆1 浣跨敤#using寮曠敤C# DLL錛岃屼笉鏄?include.鎴戝氨鏄兂褰撶劧鐨勪嬌鐢ㄤ簡鍚庤咃紝鎵浠ユ氮璐逛簡涓涓婂崍鐨勬椂闂達(dá)紱

銆銆2 鍒繕浜唘sing namespace CSLib錛?/p>

銆銆3 浣跨敤C++/clr璇硶錛岄噰鐢ㄦ紜殑璁塊棶鎵樼瀵硅薄錛屽嵆錛氫嬌鐢ㄥ附瀛?#8216;^’錛岃屼笉鏄槦鏄?#8216;*’銆?br />

PS錛氶檮涓婅嚜宸辨垚鍔熻繍琛孋++浠g爜

#include "stdafx.h"
#include <iostream>
//#using "..\..\SFCSDLL.dll" //鍙沖嚮欏圭洰-->寮曠敤...錛屾坊鍔犳柊寮曠敤錛屽皢DLL娣誨姞鍒伴」鐩腑錛屽彲浠ヤ笉鐢ㄦ琛屼唬鐮?/p>

using namespace std;
using namespace SFCSDLL;

int _tmain(int argc, _TCHAR* argv[])
{
 Class1 ^c = gcnew Class1();

 c->SFCSDLL_Create_Connection("127.0.0.1", 0, 0, 0, 0);
 c->SFCSDLL_Get_DLLVersion();
 c->SFCSDLL_Close_Connection();

 cout<<"end...";
 system("pause");
 return 0;
}

 



Ke 2013-03-12 15:13 鍙戣〃璇勮
]]>
javascript 璁$畻鏃ユ湡鐩稿樊鐨勫ぉ鏁?/title><link>http://www.tkk7.com/keweibo/articles/395722.html</link><dc:creator>Ke</dc:creator><author>Ke</author><pubDate>Tue, 26 Feb 2013 02:00:00 GMT</pubDate><guid>http://www.tkk7.com/keweibo/articles/395722.html</guid><wfw:comment>http://www.tkk7.com/keweibo/comments/395722.html</wfw:comment><comments>http://www.tkk7.com/keweibo/articles/395722.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/keweibo/comments/commentRss/395722.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/keweibo/services/trackbacks/395722.html</trackback:ping><description><![CDATA[<font face="Verdana"><html><br /> <head><br />  <script type="text/javascript"><br />   function moreThanOneMonth(dt)<br />   {<br />    var s1=new Date(dt.replace(/-/g, "/")); //鏃ユ湡鏍煎紡涓簓yyy-mm-dd杞崲鎴恲yyy/mm/dd<br />    var s2=new Date();<br />    var time= s2.getTime() - s1.getTime(); <br />    var days = parseInt(time / (1000 * 60 * 60 * 24));<br />    if(days > 30)<br />     return true;<br />    else<br />     return false;<br />   }<br />   function load(dt)<br />   {<br />    if( checkDate(dt) )<br />    {<br />     alert("days > 30");<br />    }<br />    else<br />    {<br />     alert("days < 30");<br />    }<br />   }<br />  </script><br /> </head><br /> <body onLoad="load('2013-01-01')"><br /> </body><br /></html></font><img src ="http://www.tkk7.com/keweibo/aggbug/395722.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/keweibo/" target="_blank">Ke</a> 2013-02-26 10:00 <a href="http://www.tkk7.com/keweibo/articles/395722.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>C# DataGridView鏄劇ず琛屽彿鐨勬柟娉?/title><link>http://www.tkk7.com/keweibo/articles/392802.html</link><dc:creator>Ke</dc:creator><author>Ke</author><pubDate>Tue, 11 Dec 2012 06:54:00 GMT</pubDate><guid>http://www.tkk7.com/keweibo/articles/392802.html</guid><wfw:comment>http://www.tkk7.com/keweibo/comments/392802.html</wfw:comment><comments>http://www.tkk7.com/keweibo/articles/392802.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.tkk7.com/keweibo/comments/commentRss/392802.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/keweibo/services/trackbacks/392802.html</trackback:ping><description><![CDATA[<div class="rtrhb1z" id="content" class="content mod-cs-content text-content clearfix"> <div> <p><span>緗戜笂鏈甯歌鐨勫仛娉曟槸鐢?/span><span>DataGridView</span><span>鐨?/span><span>RowPostPaint</span><span>浜嬩歡鍦?/span><span>RowHeaderCell</span><span>涓粯鍒惰鍙鳳細(xì)</span></p> <p><span>private</span><span>void</span><span>dataGridView1_RowPostPaint(</span><span>object</span><span>sender, DataGridViewRowPostPaintEventArgs e)<br />         {<br />            </span><span>try</span><span><br />             {</span></p> <p><span>       e.Graphics.DrawString((e.RowIndex + 1).ToString(), e.InheritedRowStyle.Font, new SolidBrush(Color.CadetBlue), e.RowBounds.Location.X + 15, e.RowBounds.Location.Y + 5);<br />             </span><span>}<br />            </span><span>catch</span><span>(Exception ex)<br />             {<br />                 MessageBox.Show(</span><span>"</span><span>娣誨姞琛屽彿鏃跺彂鐢熼敊璇紝閿欒淇℃伅錛?/span><span>"</span><span>+</span><span>ex.Message, </span><span>"</span><span>鎿嶄綔澶辮觸</span><span>"</span><span>);<br />             }<br />         }<br /></span></p> <p><strong><span>浣嗘槸榪欑鏂規(guī)硶鍦ㄥぇ鏁版嵁閲忕殑鏃跺欐ц兘姣旇緝宸紝姣忔婊氬姩鏁版嵁閮戒細(xì)瑙﹀彂</span><span>RowPostPaint</span><span>浜嬩歡銆?/span></strong></p></div></div><img src ="http://www.tkk7.com/keweibo/aggbug/392802.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/keweibo/" target="_blank">Ke</a> 2012-12-11 14:54 <a href="http://www.tkk7.com/keweibo/articles/392802.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>VS2008 鑷姩鐢熸垚灞炴х殑get銆乻et http://www.tkk7.com/keweibo/articles/391417.htmlKeKeFri, 16 Nov 2012 01:34:00 GMThttp://www.tkk7.com/keweibo/articles/391417.htmlhttp://www.tkk7.com/keweibo/comments/391417.htmlhttp://www.tkk7.com/keweibo/articles/391417.html#Feedback0http://www.tkk7.com/keweibo/comments/commentRss/391417.htmlhttp://www.tkk7.com/keweibo/services/trackbacks/391417.html

鍦╒S2008閲岋紝涔熷彲浠ュ儚Eclipse閭f牱鑷姩鐢熸垚get 銆乻et鏂規(guī)硶銆?br />
涓嬮潰鏄袱涓叿浣撴搷浣滅殑鏂規(guī)硶錛?br />

1銆佸湪緙栧啓鐨勫瓧孌典笂鍗曞嚮鍙抽敭----->閲嶆瀯------->灝佽瀛楁

2銆佸湪絀虹櫧琛屽錛岃緭鍏?#8220;prop”鍐嶆寜Tab閿?/p>

Ke 2012-11-16 09:34 鍙戣〃璇勮
]]>
濡備綍鏌ョ湅SQL SERVER琛ヤ竵鐨勭増鏈?/title><link>http://www.tkk7.com/keweibo/articles/391210.html</link><dc:creator>Ke</dc:creator><author>Ke</author><pubDate>Mon, 12 Nov 2012 08:19:00 GMT</pubDate><guid>http://www.tkk7.com/keweibo/articles/391210.html</guid><wfw:comment>http://www.tkk7.com/keweibo/comments/391210.html</wfw:comment><comments>http://www.tkk7.com/keweibo/articles/391210.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/keweibo/comments/commentRss/391210.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/keweibo/services/trackbacks/391210.html</trackback:ping><description><![CDATA[<p>鍘熸枃錛?a >http://hi.baidu.com/einsteinalbert/item/b0366529705c5cfb51fd87ee</a><br /><br />鏈変袱縐嶆柟娉曪細(xì)<br /><br /><strong>絎竴姝ワ細(xì)浣跨敤SQL璇彞鏌ヨ</strong><br /><br />select @@version<br /><br />鏌ヨ緇撴灉濡備笅錛?/p> <p>Microsoft SQL Server   2000 - 8.00.2039 (Intel X86) <br />   May   3 2005 23:18:38 <br />   Copyright (c) 1988-2003 Microsoft Corporation<br />   Personal Edition on Windows NT 5.1 (Build 2600: Service Pack 2)</p><br />鍏跺疄鍦–:\Program Files\Microsoft SQL Server\MSSQL\Binn\sqlservr.exe<br />鐐瑰嚮榧犳爣鍙抽敭鏌ョ湅鐗堟湰涔熻兘寰楀埌錛屼笉榪囦俊鎭瘮杈冪畝鍗曡屽凡銆?.00.2039灝變唬琛ㄥ畨瑁呯殑SQL Server鐨勭増鏈簡銆傚搴斾互涓嬬殑琛ㄦ牸錛屽彲浠ユ煡鍑烘潵鍏蜂綋瀵瑰簲鐨勮ˉ涓佺増鏈?strong style="color: #ff0000">8.00.2039琛ㄧず瀹夎浜哠P4錛?.00.760琛ㄧず瀹夎浜哠P3</strong>銆?br /><br /><strong>絎簩姝ワ細(xì)瀵圭収琛ㄦ牸鏌ユ壘鍏蜂綋鐨勮ˉ涓佺増鏈?/strong><br /><br /><strong>SQL Server Versions</strong><br /><br />@Version SQL Server Version Released <br /><br />6.50.201 SQL Server 6.5 RTM <br />6.50.213 SQL Server 6.5 with Service Pack 1 <br />6.50.240 SQL Server 6.5 with Service Pack 2 <br />6.50.258 SQL Server 6.5 with Service Pack 3 <br />6.50.281 SQL Server 6.5 with Service Pack 4 <br />6.50.415 SQL Server 6.5 with Service Pack 5 <br />6.50.416 SQL Server 6.5 with Service Pack 5a <br />7.00.623 SQL Server 7.0 / MSDE 1.0 RTM <br />7.00.699 SQL Server 7.0 SP1 July 1999 <br />7.00.842 SQL Server 7.0 SP2 March 20th, 2000 <br />7.00.961 SQL Server 7.0 SP3 December 15th, 2000 <br />7.00.1063 SQL Server 7.0 SP4 <br />8.00.194 SQL Server 2000 RTM <br />8.00.384 SQL Server 2000 SP1 <br />8.00.534 SQL Server 2000 SP2 November 30th, 2001 <br /><strong style="color: #ff0000">8.00.760 SQL Server 2000 SP3 <br />8.00.2039 SQL Server 2000 SP4</strong><strong><br /></strong><br />鏇村鐨勭増鏈鐓ц〃錛?br /><br /><strong>For SQL Server 8</strong><br /><br />Main Releases <br />@@version Version and Service Pack <br />8.00.2039 Service Pack 4<br />8.00.760 Service Pack 3 <br />8.00.534 Service Pack 2 <br />8.00.384 Service Pack 1 <br />8.00.194 RTM <br /><br />All Releases <br />@@version Version and Service Pack <br />8.00.2039 Service Pack 4<br />8.00.760 Service Pack 3 <br />8.00.686 SP 2 + Q316333 <br />8.00.679 SP 2 + Q316333 <br />8.00.665 SP 2 + Q316333 <br />8.00.655 SP 2 + Q316333 <br />8.00.650 SP 2 + Q316333 <br />8.00.644 SP 2 + Q324186 <br />8.00.608 SP 2 + Q316333/Q356326/Q356938 <br />8.00.578 SP 2 + Q316333 <br />8.00.534 Service Pack 2 <br />8.00.532 Service Pack 2 Beta <br />8.00.452 SP 1 + Q308547 <br />8.00.444 SP 1 + Q308547/Q307655 <br />8.00.443 SP 1 + Q307538 <br />8.00.428 SP 1 + Q304850 <br />8.00.384 Service Pack 1 <br />8.00.287 Q297209 <br />8.00.251 Q300194 <br />8.00.250 Q291683 <br />8.00.249 Q288122 <br />8.00.239 Q285290 <br />8.00.233 Q282416 <br />8.00.231 Q282279 <br />8.00.226 Q278239 <br />8.00.225 Q281663 <br />8.00.223 Q280380 <br />8.00.222 Q281769 <br />8.00.218 Q279183 <br />8.00.217 Q279293/Q279296 <br />8.00.211 Q276329 <br />8.00.210 Q275900 <br />8.00.205 Q274330 <br />8.00.204 Q274329 <br />8.00.194 RTM(SQL Server 8 with no service pack applied)<br /><br /><strong>For SQL Server 7</strong><br /><br />Main Releases<br />@@version Version and Service Pack <br />7.00.1063 SQL Server 7 with Service Pack 4 <br />7.00.961 SQL Server 7 with Service Pack 3 <br />7.00.842 SQL Server 7 with Service Pack 2 <br />7.00.699 SQL Server 7 with Service Pack 1 <br />7.00.623 SQL Server 7 with no service pack applied <br /><br /><strong>For SQL Server 6.5</strong><br /><br />Main Releases<br />@@version Version and Service Pack <br />6.50.479 SQL Server 6.5 with Service Pack 5a (updated) <br />6.50.416 SQL Server 6.5 with Service Pack 5a. <br />6.50.415 SQL Server 6.5 with Service Pack 5 <br />6.50.281 SQL Server 6.5 with Service Pack 4 <br />6.50.258 SQL Server 6.5 with Service Pack 3 <br />6.50.240 SQL Server 6.5 with Service Pack 2 <br />6.50.213 SQL Server 6.5 with Service Pack 1 <br />6.50.201 SQL Server 6.5 with no service pack applied <br /><br /><strong>For SQL Server 6</strong><br /><br />Main Releases<br />@@version Version and Service Pack <br />6.00.151 SQL Server 6 with Service Pack 3 <br />6.00.139 SQL Server 6 with Service Pack 2 <br />6.00.124 SQL Server 6 with Service Pack 1 <br />6.00.121 SQL Server 6 with no service pack applied <br /><br /><strong>琛ュ厖</strong><br />For SQL Server 2005<br />鎵撲簡sp3鍚庣増鏈彿鏄?nbsp;<strong>9.0.4035</strong>濡傛灉鏄繖涓棫璇存槑涓嶇敤鎵撲簡錛屽鏋滄瘮榪欎釜浣庯紝璇存槑娌℃湁鎵?img src ="http://www.tkk7.com/keweibo/aggbug/391210.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/keweibo/" target="_blank">Ke</a> 2012-11-12 16:19 <a href="http://www.tkk7.com/keweibo/articles/391210.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item></channel></rss> <footer> <div class="friendship-link"> <p>感谢您访问我们的网站,您可能还对以下资源感兴趣:</p> <a href="http://www.tkk7.com/" title="亚洲av成人片在线观看">亚洲av成人片在线观看</a> <div class="friend-links"> </div> </div> </footer> 主站蜘蛛池模板: <a href="http://a8g8.com" target="_blank">最近中文字幕大全免费版在线 </a>| <a href="http://5g6z.com" target="_blank">成人亚洲国产精品久久</a>| <a href="http://yw756.com" target="_blank">相泽南亚洲一区二区在线播放</a>| <a href="http://youkabaitiao.com" target="_blank">久艹视频在线免费观看</a>| <a href="http://25v8.com" target="_blank">妞干网在线免费视频</a>| <a href="http://bjsymsdwl.com" target="_blank">亚洲精品和日本精品</a>| <a href="http://yytengsheng.com" target="_blank">亚洲AV日韩AV永久无码免下载</a>| <a href="http://gzmkqp.com" target="_blank">亚洲中文无码线在线观看</a>| <a href="http://dqmovie.com" target="_blank">亚洲国产亚洲综合在线尤物</a>| <a href="http://uu313.com" target="_blank">久久WWW免费人成—看片</a>| <a href="http://jst-hosp.com" target="_blank">久久综合给合久久国产免费</a>| <a href="http://cztshw.com" target="_blank">日韩免费无砖专区2020狼</a>| <a href="http://jhmydxx.com" target="_blank">亚洲精品无码久久久影院相关影片</a>| <a href="http://shaolingtongluo.com" target="_blank">亚洲激情校园春色</a>| <a href="http://abab14.com" target="_blank">国产成人精品亚洲</a>| <a href="http://33dh2.com" target="_blank">三年片在线观看免费观看大全动漫</a>| <a href="http://513109.com" target="_blank">免费无码精品黄AV电影</a>| <a href="http://963315.com" target="_blank">国产亚洲?V无码?V男人的天堂 </a>| <a href="http://bearsou.com" target="_blank">亚洲成a人片在线网站</a>| <a href="http://www003924.com" target="_blank">无遮挡呻吟娇喘视频免费播放</a>| <a href="http://91packing.com" target="_blank">可以免费观看的国产视频</a>| <a href="http://niu44.com" target="_blank">永久免费bbbbbb视频</a>| <a href="http://g8zb.com" target="_blank">亚洲邪恶天堂影院在线观看</a>| <a href="http://yw756.com" target="_blank">337P日本欧洲亚洲大胆精品</a>| <a href="http://jl910.com" target="_blank">国产精品美女午夜爽爽爽免费</a>| <a href="http://paweax.com" target="_blank">亚洲网站在线播放</a>| <a href="http://438266.com" target="_blank">亚欧日韩毛片在线看免费网站</a>| <a href="http://yuejiju.com" target="_blank">亚洲精品乱码久久久久久蜜桃不卡 </a>| <a href="http://www3ratcom.com" target="_blank">ASS亚洲熟妇毛茸茸PICS</a>| <a href="http://600c28.com" target="_blank">一二三区免费视频</a>| <a href="http://58f8.com" target="_blank">无限动漫网在线观看免费</a>| <a href="http://51jingpai.com" target="_blank">亚洲热妇无码AV在线播放</a>| <a href="http://cz655.com" target="_blank">亚洲国产精品自在自线观看</a>| <a href="http://wwwfafa98.com" target="_blank">免费在线观影网站</a>| <a href="http://scdsrq.com" target="_blank">国产成人麻豆亚洲综合无码精品</a>| <a href="http://ahbbht.com" target="_blank">亚洲私人无码综合久久网</a>| <a href="http://scdsrq.com" target="_blank">久久国产精品2020免费m3u8</a>| <a href="http://625r.com" target="_blank">亚洲国产精品嫩草影院在线观看 </a>| <a href="http://tedegold.com" target="_blank">成全高清在线观看免费</a>| <a href="http://bjyaao.com" target="_blank">中文字幕在线亚洲精品</a>| <a href="http://zgj688.com" target="_blank">中文永久免费观看网站</a>| <script> (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })(); </script> </body>