<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>追風箏的小孩 &#187; VB.NET</title>
	<atom:link href="http://m955.com/wp/archives/tag/vbnet/feed" rel="self" type="application/rss+xml" />
	<link>http://m955.com/wp</link>
	<description></description>
	<lastBuildDate>Thu, 03 Nov 2011 14:47:32 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>利用commandbuilder來節省設定屬性與參數步驟</title>
		<link>http://m955.com/wp/archives/150</link>
		<comments>http://m955.com/wp/archives/150#comments</comments>
		<pubDate>Fri, 12 Sep 2008 08:12:40 +0000</pubDate>
		<dc:creator>blue955</dc:creator>
				<category><![CDATA[程式]]></category>
		<category><![CDATA[VB.NET]]></category>

		<guid isPermaLink="false">http://m955.com/wp/?p=150</guid>
		<description><![CDATA[PLAIN TEXT
VB.NET:




'建立 DataAdapter 物件


&#160; &#160; Dim objCmd As New OleDbDataAdapter&#40;"Select * From 成績單", objConn&#41;


'建立 CommandBuilder 物件


&#160; &#160; Dim objCB As OleDbCommandBuilder = New OleDbCommandBuilder&#4... ]]></description>
			<content:encoded><![CDATA[<div class="igBar"><span id="lvbnet-2"><a href="#" onclick="javascript:showPlainTxt('vbnet-2'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">VB.NET:</span>
<div id="vbnet-2">
<div class="vbnet">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #008080; font-style: italic;">'建立 DataAdapter 物件</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0600FF;">Dim</span> objCmd <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">New</span> OleDbDataAdapter<span style="color: #000000;">&#40;</span><span style="color: #808080;">"Select * From 成績單"</span>, objConn<span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #008080; font-style: italic;">'建立 CommandBuilder 物件</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0600FF;">Dim</span> objCB <span style="color: #FF8000;">As</span> OleDbCommandBuilder = <span style="color: #FF8000;">New</span> OleDbCommandBuilder<span style="color: #000000;">&#40;</span>objCmd<span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #008080; font-style: italic;">'建立 DataSet 物件，並將 SelectCommand 的執行結果置入 DataSet 物件中</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #0600FF;">Dim</span> DS <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">New</span> DataSet<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;objCmd.<span style="color: #0000FF;">Fill</span><span style="color: #000000;">&#40;</span>DS, <span style="color: #808080;">"成績單"</span><span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #008080; font-style: italic;">'建立 myTable 為 DataTable 物件，將 DataSet 物件的成績單資料表指定給 myTable&nbsp; &nbsp; </span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #0600FF;">Dim</span> myTable <span style="color: #FF8000;">As</span> DataTable = DS.<span style="color: #0000FF;">Tables</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">"成績單"</span><span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #008080; font-style: italic;">'修改資料列</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;myTable.<span style="color: #0000FF;">Rows</span><span style="color: #000000;">&#40;</span><span style="color: #FF0000;color:#800000;">6</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">"統計"</span><span style="color: #000000;">&#41;</span> = <span style="color: #FF0000;color:#800000;">80</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #008080; font-style: italic;">'刪除資料列</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;myTable.<span style="color: #0000FF;">Rows</span><span style="color: #000000;">&#40;</span><span style="color: #FF0000;color:#800000;">4</span><span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">Delete</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #008080; font-style: italic;">'新增資料列</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #0600FF;">Dim</span> myRow <span style="color: #FF8000;">As</span> DataRow = myTable.<span style="color: #0000FF;">NewRow</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;myRow<span style="color: #000000;">&#40;</span><span style="color: #808080;">"學號"</span><span style="color: #000000;">&#41;</span> = <span style="color: #808080;">"A8608011"</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;myRow<span style="color: #000000;">&#40;</span><span style="color: #808080;">"姓名"</span><span style="color: #000000;">&#41;</span> = <span style="color: #808080;">"小丸子"</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;myRow<span style="color: #000000;">&#40;</span><span style="color: #808080;">"會計"</span><span style="color: #000000;">&#41;</span> = <span style="color: #FF0000;color:#800000;">95</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;myRow<span style="color: #000000;">&#40;</span><span style="color: #808080;">"統計"</span><span style="color: #000000;">&#41;</span> = <span style="color: #FF0000;color:#800000;">70</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;myTable.<span style="color: #0000FF;">Rows</span>.<span style="color: #0000FF;">Add</span><span style="color: #000000;">&#40;</span>myRow<span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #008080; font-style: italic;">'將 DataSet 物件的資料更新到來源資料</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;objCmd.<span style="color: #0000FF;">Update</span><span style="color: #000000;">&#40;</span>DS, <span style="color: #808080;">"成績單"</span><span style="color: #000000;">&#41;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://m955.com/wp/archives/150/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>建立資料庫連接字串的方法</title>
		<link>http://m955.com/wp/archives/123</link>
		<comments>http://m955.com/wp/archives/123#comments</comments>
		<pubDate>Tue, 20 May 2008 15:32:38 +0000</pubDate>
		<dc:creator>blue955</dc:creator>
				<category><![CDATA[程式]]></category>
		<category><![CDATA[ADO.NET]]></category>
		<category><![CDATA[VB.NET]]></category>

		<guid isPermaLink="false">http://m955.com/wp/?p=123</guid>
		<description><![CDATA[一、使用 ConnectionStringBuilder
1.連接 Access
PLAIN TEXT
VB.NET:




Dim builder As New OleDbConnectionStringBuilder


builder.Provider = "Microsoft.Jet.OLEDB.4.0"


builder.DataSource = "&#124;DataDirectory&#124;\test.mdb"


builder.Add&#40;"Jet ... ]]></description>
			<content:encoded><![CDATA[<p>一、使用 ConnectionStringBuilder<br />
1.連接 Access</p>
<div class="igBar"><span id="lvbnet-7"><a href="#" onclick="javascript:showPlainTxt('vbnet-7'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">VB.NET:</span>
<div id="vbnet-7">
<div class="vbnet">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0600FF;">Dim</span> builder <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">New</span> OleDbConnectionStringBuilder</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">builder.<span style="color: #0000FF;">Provider</span> = <span style="color: #808080;">"Microsoft.Jet.OLEDB.4.0"</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">builder.<span style="color: #0000FF;">DataSource</span> = <span style="color: #808080;">"|DataDirectory|\test.mdb"</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">builder.<span style="color: #0000FF;">Add</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">"Jet OLEDB:Database Password"</span>, <span style="color: #808080;">"123456"</span><span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0600FF;">Dim</span> <span style="color: #0600FF;">str</span> <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">String</span> = builder.<span style="color: #0000FF;">ConnectionString</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">Return <span style="color: #0600FF;">str</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p>
<span id="more-123"></span><br />
2.連接 SQLServer</p>
<div class="igBar"><span id="lvbnet-8"><a href="#" onclick="javascript:showPlainTxt('vbnet-8'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">VB.NET:</span>
<div id="vbnet-8">
<div class="vbnet">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0600FF;">Dim</span> builder <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">New</span> SqlConnectionStringBuilder</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">builder.<span style="color: #0000FF;">DataSource</span> = <span style="color: #808080;">"(local)\SQLEXPRESS"</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">builder.<span style="color: #0000FF;">InitialCatalog</span> = <span style="color: #808080;">"北風貿易"</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">builder.<span style="color: #0000FF;">IntegratedSecurity</span> = <span style="color: #0600FF;">True</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0600FF;">Dim</span> <span style="color: #0600FF;">str</span> <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">String</span> = builder.<span style="color: #0000FF;">ConnectionString</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">Return <span style="color: #0600FF;">str</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>3.連接 MySql (必須安裝 <a href="http://dev.mysql.com/downloads/connector/" target="_blank">MySql.Data</a> 外掛) 請參考...</p>
<div class="igBar"><span id="lvbnet-9"><a href="#" onclick="javascript:showPlainTxt('vbnet-9'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">VB.NET:</span>
<div id="vbnet-9">
<div class="vbnet">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0600FF;">Imports</span> MySql.<span style="color: #0000FF;">Data</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0600FF;">Imports</span> MySql.<span style="color: #0000FF;">Data</span>.<span style="color: #0000FF;">MySqlClient</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #FF8000;">Public</span> <span style="color: #0600FF;">Class</span> Form1</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #FF8000;">Private</span> <span style="color: #0600FF;">Sub</span> Form1_Load<span style="color: #000000;">&#40;</span><span style="color: #FF8000;">ByVal</span> sender <span style="color: #FF8000;">As</span> System.<span style="color: #FF0000;">Object</span>, _</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #FF8000;">ByVal</span> e <span style="color: #FF8000;">As</span> System.<span style="color: #0000FF;">EventArgs</span><span style="color: #000000;">&#41;</span> <span style="color: #FF8000;">Handles</span> <span style="color: #FF8000;">MyBase</span>.<span style="color: #0000FF;">Load</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Dim</span> builder <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">New</span> MySqlConnectionStringBuilder</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; builder.<span style="color: #0000FF;">Server</span> = <span style="color: #808080;">"localhost"</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; builder.<span style="color: #0000FF;">UserID</span> = <span style="color: #808080;">"root"</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; builder.<span style="color: #0000FF;">Password</span> = <span style="color: #808080;">"123456"</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; builder.<span style="color: #0000FF;">Database</span> = <span style="color: #808080;">"test"</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Dim</span> <span style="color: #0600FF;">str</span> <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">String</span> = builder.<span style="color: #0000FF;">ConnectionString</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Dim</span> conn <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">New</span> MySqlConnection<span style="color: #000000;">&#40;</span><span style="color: #0600FF;">str</span><span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Dim</span> commCMD <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">String</span> = <span style="color: #808080;">"select * from product"</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Dim</span> da <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">New</span> MySqlDataAdapter<span style="color: #000000;">&#40;</span>commCMD, conn<span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Dim</span> ds <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">New</span> DataSet</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; conn.<span style="color: #0600FF;">Open</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; da.<span style="color: #0000FF;">Fill</span><span style="color: #000000;">&#40;</span>ds, <span style="color: #808080;">"pro"</span><span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; DataGridView1.<span style="color: #0000FF;">DataSource</span> = ds.<span style="color: #0000FF;">Tables</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">"pro"</span><span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; conn.<span style="color: #0600FF;">Close</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Sub</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Class</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>二、使用自行撰寫連線字串，此方法容易因為人為疏失而產生錯誤<br />
1.連接 SQLServer</p>
<div class="igBar"><span id="lvbnet-10"><a href="#" onclick="javascript:showPlainTxt('vbnet-10'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">VB.NET:</span>
<div id="vbnet-10">
<div class="vbnet">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #FF8000;">Me</span>.<span style="color: #0000FF;">SqlConnection1</span>.<span style="color: #0000FF;">ConnectionString</span> = _</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080;">"Data Source=(local)\SQLEXPRESS; _</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080;">Initial Catalog=北風貿易; _</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080;">Integrated Security=True"</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://m955.com/wp/archives/123/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>ComboBox 的資料繫結合傳遞參數</title>
		<link>http://m955.com/wp/archives/111</link>
		<comments>http://m955.com/wp/archives/111#comments</comments>
		<pubDate>Thu, 08 May 2008 10:11:42 +0000</pubDate>
		<dc:creator>blue955</dc:creator>
				<category><![CDATA[程式]]></category>
		<category><![CDATA[VB.NET]]></category>

		<guid isPermaLink="false">http://m955.com/wp/archives/111</guid>
		<description><![CDATA[&#160;&#160;&#160;&#160;&#160;&#160;&#160; 相信大家應該都在教科書上看過資料繫結分為：簡單繫結和複雜繫結，簡單繫結就是把元件的 Binding 屬性連結到資料來源，而複雜繫結運用在有支援 iList 介面的... ]]></description>
			<content:encoded><![CDATA[<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; 相信大家應該都在教科書上看過資料繫結分為：簡單繫結和複雜繫結，簡單繫結就是把元件的 Binding 屬性連結到資料來源，而複雜繫結運用在有支援 iList 介面的控制項，例如：DataGrid、ListBox、ComboBox 與 ErrorProvider控制項皆支援複雜的資料繫結。</p>
<p><span id="more-111"></span></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; 那 iList 介面是啥？就目前我還不知道，不過會用就好，微軟常常把一些名詞弄得很複雜，一看就感到很難似的！題外話！今天討論的是 ComboBox，這幾天弄得有一些小小的心得！</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; 今天如果要在 ComboBox 繫結資料的話，先瞭解一下下面 ComboBox 的一些屬性名詞，據我的經驗，懂了這一些屬性之後，管你要結上啥資料，都可以啦！</p>
<p>1：<strong><font color="#0000ff">ComboBox.DataSource</font></strong>    <br />&#160;&#160;&#160;&#160; 資料的來源，可能是 DataSet、DataTable 或者泛型集合，只要可以提供資料者皆可！</p>
<p>2：<strong><font color="#0000ff">ComboBox.DisplayMember</font></strong>    <br />&#160;&#160;&#160;&#160; 就字面上解釋，顯示的成員，就是你要放在下拉選單中讓使用者選擇的項目，當然！必須包含在 DataSource 中，不然就會找不到。</p>
<p>3：<strong><font color="#0000ff">ComboBox .ValueMember</font></strong>    <br />&#160;&#160;&#160;&#160; 英翻中，變數成員，今天有的下拉的選項之後，可能是帶變數的字串，這個就是用來指定各成員的代表變數，例：下拉選單有產品的類別：五金類、家庭類、油漆類...，不過寫入資料庫的值是各分類的代表數字，這個時候就可以來使用 ValueMember。</p>
<p>4：<strong><font color="#0000ff">ComboBox .SelectedIndex</font></strong>    <br />&#160;&#160;&#160;&#160; 當你使用了 ValueMember 之後，ValueMember 就會把選擇的值丟到 SelectedIndex 裡，我們再透過 SelectedIndex 來取出所選擇的值，例：lbl1.Text = ComboBox .SelectedIndex.ToString ，這時候控制項 lbl1 就會出現我們在 ComboBox 所選的代表變數。</p>
]]></content:encoded>
			<wfw:commentRss>http://m955.com/wp/archives/111/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>VB2005 會自動切換成全形</title>
		<link>http://m955.com/wp/archives/108</link>
		<comments>http://m955.com/wp/archives/108#comments</comments>
		<pubDate>Fri, 02 May 2008 14:29:01 +0000</pubDate>
		<dc:creator>blue955</dc:creator>
				<category><![CDATA[程式]]></category>
		<category><![CDATA[VB.NET]]></category>

		<guid isPermaLink="false">http://m955.com/wp/?p=108</guid>
		<description><![CDATA[我相信應該有些人會遇到跟我一樣的問題
從vb2005編譯出來的textbox，使用者在輸入時會自動切換成全型
甚至在開發視窗裡也會有這樣的問題，這的確是一件很煩人的事
輸入中文倒是沒影響，不... ]]></description>
			<content:encoded><![CDATA[<p>我相信應該有些人會遇到跟我一樣的問題</p>
<p>從vb2005編譯出來的textbox，使用者在輸入時會自動切換成全型</p>
<p>甚至在開發視窗裡也會有這樣的問題，這的確是一件很煩人的事</p>
<p>輸入中文倒是沒影響，不過輸入英數就會變成全形</p>
<p><span id="more-108"></span></p>
<p>ABCD → ＡＢＣＤ<br />
1234 → １２３４</p>
<p>問GOOGLE大神，他說要裝修補程式：KB925488</p>
<p>不過我裝了也沒啥差別，沒有放上來，有需要的人在寫信給我吧！</p>
<p>在藍色小舖上有看到一個解決的方法，有需要的人拿去用看看</p>
<p>我自己呢？跟著做了之後，有些有用有些無用</p>
<p>先宣告一各類別</p>
<div class="igBar"><span id="lvb-13"><a href="#" onclick="javascript:showPlainTxt('vb-13'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Visual Basic:</span>
<div id="vb-13">
<div class="vb">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">Public</span> Class ImeForm</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; Inherits System.<span style="color: #66cc66;">Windows</span>.<span style="color: #66cc66;">Forms</span>.<span style="color: #66cc66;">Form</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">Private</span> <span style="color: #b1b100;">Declare</span> <span style="color: #b1b100;">Function</span> ImmGetContext Lib <span style="color: #ff0000;">"imm32.dll"</span> <span style="color:#006600; font-weight:bold;">&#40;</span>ByVal hwnd <span style="color: #b1b100;">As</span> <span style="color: #b1b100;">Integer</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color: #b1b100;">As</span> <span style="color: #b1b100;">Integer</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">Private</span> <span style="color: #b1b100;">Declare</span> <span style="color: #b1b100;">Function</span> ImmGetConversionStatus Lib <span style="color: #ff0000;">"imm32.dll"</span> <span style="color:#006600; font-weight:bold;">&#40;</span>ByVal himc <span style="color: #b1b100;">As</span> <span style="color: #b1b100;">Integer</span>, ByRef lpdw <span style="color: #b1b100;">As</span> <span style="color: #b1b100;">Integer</span>, ByRef lpdw2 <span style="color: #b1b100;">As</span> <span style="color: #b1b100;">Integer</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color: #b1b100;">As</span> <span style="color: #b1b100;">Integer</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">Private</span> <span style="color: #b1b100;">Declare</span> <span style="color: #b1b100;">Function</span> ImmSimulateHotKey Lib <span style="color: #ff0000;">"imm32.dll"</span> <span style="color:#006600; font-weight:bold;">&#40;</span>ByVal hwnd <span style="color: #b1b100;">As</span> <span style="color: #b1b100;">Integer</span>, ByVal dw <span style="color: #b1b100;">As</span> <span style="color: #b1b100;">Integer</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color: #b1b100;">As</span> <span style="color: #b1b100;">Integer</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">Private</span> <span style="color: #b1b100;">Sub</span> Form_Load<span style="color:#006600; font-weight:bold;">&#40;</span>ByVal eventSender <span style="color: #b1b100;">As</span> System.<span style="color: #66cc66;">Object</span>, ByVal eventArgs <span style="color: #b1b100;">As</span> System.<span style="color: #66cc66;">EventArgs</span><span style="color:#006600; font-weight:bold;">&#41;</span> Handles MyBase.<span style="color: #66cc66;">Load</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">For</span> Each objCtl <span style="color: #b1b100;">As</span> Control In <span style="color: #b1b100;">Me</span>.<span style="color: #66cc66;">Controls</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; AddHandler objCtl.<span style="color: #66cc66;">GotFocus</span>, AddressOf ControlIME</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">Next</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">End</span> <span style="color: #b1b100;">Sub</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">Private</span> <span style="color: #b1b100;">Sub</span> Form_Paint<span style="color:#006600; font-weight:bold;">&#40;</span>ByVal sender <span style="color: #b1b100;">As</span> Object, ByVal e <span style="color: #b1b100;">As</span> System.<span style="color: #66cc66;">Windows</span>.<span style="color: #66cc66;">Forms</span>.<span style="color: #66cc66;">PaintEventArgs</span><span style="color:#006600; font-weight:bold;">&#41;</span> Handles <span style="color: #b1b100;">Me</span>.<span style="color: #66cc66;">Paint</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; ControlIME<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #b1b100;">Me</span>, <span style="color: #b1b100;">Nothing</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">End</span> <span style="color: #b1b100;">Sub</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">Private</span> Shared <span style="color: #b1b100;">Sub</span> ControlIME<span style="color:#006600; font-weight:bold;">&#40;</span>ByVal sender <span style="color: #b1b100;">As</span> Object, ByVal e <span style="color: #b1b100;">As</span> System.<span style="color: #66cc66;">EventArgs</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">Dim</span> lngStatus <span style="color: #b1b100;">As</span> <span style="color: #b1b100;">Long</span>, lngSt <span style="color: #b1b100;">As</span> <span style="color: #b1b100;">Long</span>, h <span style="color: #b1b100;">As</span> IntPtr = sender.<span style="color: #66cc66;">Handle</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; ImmGetConversionStatus<span style="color:#006600; font-weight:bold;">&#40;</span>ImmGetContext<span style="color:#006600; font-weight:bold;">&#40;</span>h<span style="color:#006600; font-weight:bold;">&#41;</span>, lngStatus, lngSt<span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">If</span> lngStatus = <span style="color: #cc66cc;color:#800000;">9</span> <span style="color: #b1b100;">Then</span> ImmSimulateHotKey<span style="color:#006600; font-weight:bold;">&#40;</span>h, <span style="color: #cc66cc;color:#800000;">113</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">End</span> <span style="color: #b1b100;">Sub</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">End</span> Class </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>之後再每一個 Form 中繼承這一個類別</p>
<div class="igBar"><span id="lvb-14"><a href="#" onclick="javascript:showPlainTxt('vb-14'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Visual Basic:</span>
<div id="vb-14">
<div class="vb">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">Inherits ImeForm </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>之後再將 Form 中的IME 模式開啟 ON</p>
<p>大家試試看吧！</p>
<p>我之後是將 XP 內建的新注音換成自然輸入，這問題才解決，不過這不是解決事情的辦法啊！</p>
]]></content:encoded>
			<wfw:commentRss>http://m955.com/wp/archives/108/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>VB2005  ImeMode 屬性</title>
		<link>http://m955.com/wp/archives/106</link>
		<comments>http://m955.com/wp/archives/106#comments</comments>
		<pubDate>Thu, 01 May 2008 00:23:21 +0000</pubDate>
		<dc:creator>blue955</dc:creator>
				<category><![CDATA[程式]]></category>
		<category><![CDATA[VB.NET]]></category>

		<guid isPermaLink="false">http://m955.com/wp/?p=106</guid>
		<description><![CDATA[Alpha
字母數字單字節字符 (SBC)。此設置僅對朝鮮語和日語 IME 有效。 

AlphaFull
字母數字雙字節字符。此設置僅對朝鮮語和日語 IME 有效。 
Close
關閉
Disable
IME 被禁用。如果使用此設置，則用戶無... ]]></description>
			<content:encoded><![CDATA[<p>Alpha<br />
字母數字單字節字符 (SBC)。此設置僅對朝鮮語和日語 IME 有效。 </p>
<p><span id="more-106"></span></p>
<p>AlphaFull<br />
字母數字雙字節字符。此設置僅對朝鮮語和日語 IME 有效。 </p>
<p>Close<br />
關閉</p>
<p>Disable<br />
IME 被禁用。如果使用此設置，則用戶無法從鍵盤打開 IME，而且 IME 浮動窗口處於隱藏狀態。 </p>
<p>Hangul<br />
朝鮮文 SBC。此設置僅對朝鮮語 IME 有效。 </p>
<p>HangulFull<br />
朝鮮文 DBC。此設置僅對朝鮮語 IME 有效。 </p>
<p>Hiragana<br />
平假名 DBC。此設置僅對日語 IME 有效。</p>
<p>Inherit<br />
繼承父控件的 IME 模式。 </p>
<p>Katakana<br />
片假名 DBC。此設置僅對日語 IME 有效。 </p>
<p>KatakanaHalf<br />
片假名 SBC。此設置僅對日語 IME 有效。 </p>
<p>NoControl<br />
無（預設）。 </p>
<p>Off<br />
IME 已關閉。此模式指示 IME 已關閉，這意味著該對象的行為方式與英語輸入模式相同。此設置僅對日語、簡體中文和繁體中文 IME 有效。 </p>
<p>On<br />
IME 已打開。此值指示 IME 已打開，可以輸入中文或日語特定的字符。此設置僅對日語、簡體中文和繁體中文 IME 有效。 </p>
]]></content:encoded>
			<wfw:commentRss>http://m955.com/wp/archives/106/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

