??xml version="1.0" encoding="utf-8" standalone="yes"?>欧美精品色一区二区三区,精品久久人人做人人爱,亚洲色图第三页http://www.aygfsteel.com/yuanhuaming/category/2773.html无论是批评的Q赞扬的Q指着的都请EMAILl我Q你的徏议将是我前进的动? <A href=mailto:yuanhuaming@56.com >联系?lt;/A>zh-cnFri, 02 Mar 2007 07:42:05 GMTFri, 02 Mar 2007 07:42:05 GMT60ActiveReport之事件篇 http://www.aygfsteel.com/yuanhuaming/archive/2006/08/03/61492.html疯流成?/dc:creator>疯流成?/author>Thu, 03 Aug 2006 05:16:00 GMThttp://www.aygfsteel.com/yuanhuaming/archive/2006/08/03/61492.htmlhttp://www.aygfsteel.com/yuanhuaming/comments/61492.htmlhttp://www.aygfsteel.com/yuanhuaming/archive/2006/08/03/61492.html#Feedback0http://www.aygfsteel.com/yuanhuaming/comments/commentRss/61492.htmlhttp://www.aygfsteel.com/yuanhuaming/services/trackbacks/61492.html 1.       只触发一ơ的事gQ?/span>

ReportStart Q?/span> 在报表启动时触发。该事g?/span> DataInitialize 之前Q在q里可以整个报表都要用到的对象或变量作初始化Q也可以讄子报表?/span>

DataInitialize Q这个事件在前面的几随W中l常出现Q经常在q里取数据,l定数据源,讄报表?/span> Fileds 属性等?/span>

ReportEnd Q?/span> 在报表加载完成后触发?/span>

2.       多次触发的事Ӟ

FetchData Q? 在处理每一条数据时都会触发Q如果是采用l定数据源的方式Q就不需要再作对 Fields 中每?/span> Field ?/span> Value 赋倹{如果是从自定义的对象集合中提取数据Q就要在q里l?/span> Fields 赋倹{而且Q用自定义集合的时候要自己讄事g?/span> eArgs 参数?/span> EOF 属性,该属性用来判断是否显C到了最后一条记录,如果是,p|ؓ true Qƈ且直接返回。具体的代码可以参看以前的随W?/span>

PageStart Q?/span> 在报表的每页生成的时候触发,在这里作针对每个늚处理Q最常见的就是显C页码?/span>

PageEnd Q?/span> 在报表的每也生成完成的时候触发?/span>

3.       区域的事Ӟ

每个区域Q?/span> PageHeader Q?/span> Detail Q?/span> PageFooter Q都?/span> Format Q?/span> BeforePrint ?/span> AfterPrint 事g。最好不要在q几个事件中操作报表?/span> Fields 集合Q而应该在 DataInitialize ?/span> FetchData 中进行?/span>

Format Q?/span> 在数据加载ƈl定后触发,只有在这里才可以讄某个区域的高度?/span>

BeforePrint Q?/span> 在区域被生成前触发,在这里如果设|区域的高度是不会有效果的,而且不要在这里操作数据源?/span>

AfterPrint Q?/span> 在区域已l被生成q描d后发生,可以在该事g里直接在d上进行描L作?/span>

]]>
在写E序的时候,h意特D字W的转义~~~http://www.aygfsteel.com/yuanhuaming/archive/2006/07/19/58936.html疯流成?/dc:creator>疯流成?/author>Wed, 19 Jul 2006 02:51:00 GMThttp://www.aygfsteel.com/yuanhuaming/archive/2006/07/19/58936.htmlhttp://www.aygfsteel.com/yuanhuaming/comments/58936.htmlhttp://www.aygfsteel.com/yuanhuaming/archive/2006/07/19/58936.html#Feedback0http://www.aygfsteel.com/yuanhuaming/comments/commentRss/58936.htmlhttp://www.aygfsteel.com/yuanhuaming/services/trackbacks/58936.html前天被测试组查出来的一个BUGQ就是在输入"'"的时候报错了。因为数据库是ORACLEQ?是关键字Q所以抛了异常?br />
解决ҎQ?br />1.可以先预~译?
2.是转义?string.replace("'" ,"''")

我认个BUG出的?映像比较深刻.在今后的开发过E中,在{义方面留了一个心?





]]>
多本E序同时写LOG出现的问?/title><link>http://www.aygfsteel.com/yuanhuaming/archive/2006/07/19/58919.html</link><dc:creator>疯流成?/dc:creator><author>疯流成?/author><pubDate>Wed, 19 Jul 2006 02:16:00 GMT</pubDate><guid>http://www.aygfsteel.com/yuanhuaming/archive/2006/07/19/58919.html</guid><wfw:comment>http://www.aygfsteel.com/yuanhuaming/comments/58919.html</wfw:comment><comments>http://www.aygfsteel.com/yuanhuaming/archive/2006/07/19/58919.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/yuanhuaming/comments/commentRss/58919.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/yuanhuaming/services/trackbacks/58919.html</trackback:ping><description><![CDATA[ <p>l合试的时候偶会出现Qネットワー?パスが見つかりません?br />我们一开始都以ؓ是网l的问题Q但是一直都解决不了?br />今天某h无聊试LOG的时候,真相l于水落矛_了?br />试环境Qwin2000Q?本只写LOG的程序?br />?本程序同时写LOGC个日志中的时候会出现上诉ERROR?br /><br />让h很意外,写LOG居然报网l\径找不到。经验值又上升?br /><br /><br /><br /><br /><br /></p> <img src ="http://www.aygfsteel.com/yuanhuaming/aggbug/58919.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/yuanhuaming/" target="_blank">疯流成?/a> 2006-07-19 10:16 <a href="http://www.aygfsteel.com/yuanhuaming/archive/2006/07/19/58919.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>.net常用函数http://www.aygfsteel.com/yuanhuaming/archive/2006/06/16/53154.html疯流成?/dc:creator>疯流成?/author>Fri, 16 Jun 2006 01:21:00 GMThttp://www.aygfsteel.com/yuanhuaming/archive/2006/06/16/53154.htmlhttp://www.aygfsteel.com/yuanhuaming/comments/53154.htmlhttp://www.aygfsteel.com/yuanhuaming/archive/2006/06/16/53154.html#Feedback0http://www.aygfsteel.com/yuanhuaming/comments/commentRss/53154.htmlhttp://www.aygfsteel.com/yuanhuaming/services/trackbacks/53154.htmlVal(string) 代表数字的字符串{换ؓ数值型态,若字W串中含有非数字的内容则会将其去除后Q合qؓ一数字?
Weekday(date) 取的参数中的日期是一个星期的W几天,星期天ؓ1、星期一?、星期二? 依此cL?
WeekDayName(number) 依接收的参数取得星期的名Uͼ可接收的参数? ?Q星期天?、星期一?、星期二? 依此cL?
Split(expression[, delimiter]) 以delimiter 参数讑֮的条件字W串来将字符串分割ؓ字符串数l?
Sqrt(number) 取得一数值得qx栏V?
Str(number) 数字{为字W串后传回?
StrReverse(expression) 取得字符串内容反转后的结果?
Tan(number) 取得某个角度的正切倹{?
TimeOfDay() 取得目前不包含日期的旉?
Timer() 取得?:00 到目前时间的U数Q型态ؓDouble?
TimeSerial(hour, minute, second) 接收的参数合ƈZ个只有时间Date 型态的数据?
Timavalue(time) 取得W合国别讑֮样式的时间倹{?
Today() 取得今天不包含时间的日期?
Trim(string) L字符串开头和l尾的空白?
TypeName(varname) 取得变量或对象的型态?
Ubound(arrayname[, dimension]) 取得数组的最l烦引|dimension 参数是指定取得第几维度的最l烦引倹{?
MonthName(month) 依接收的月䆾数值取得该月䆾的完整写法?
Now() 取得目前的日期和旉?
Oct(number) 数值参数{换ؓ8 q制倹{?
Replace(expression, find, replace) 字W串中find 参数指定的字W串转换为replace 参数指定的字W串?
Right(string,length) 由字W串双开始取得length 参数讑֮长度的字W?
RmDir(path) U除一个空的目录?
Rnd() 取得介于0 ? 之间的小敎ͼ如果每次都要取得不同的|使用前需加上Randomize 叙述?
Rtrim(string) L字符串的双I白部分?
Second(time) 取得旉内容的秒部分Q型态ؓInteger?
Sign(number) 取得数值内Ҏ正数或负敎ͼ正数传回1Q负C?1Q? 传回0?
Sin(number) 取得一个角度的正u倹{?
Space(number) 取得number 参数讑֮的空白字W串?
IsDate(expression) 判断表达式内Ҏ否ؓDateTime 型态,若是则传回TrueQ反之则为False?
IsDbNull(expression) 判断表达式内Ҏ否ؓNullQ若是则传回TrueQ反之则为False?
IsNumeric(expression) 判断表达式内Ҏ否ؓ数值型态,若是则传回TrueQ反之则为False?
Join(sourcearray[, delimiter]) 字W串数组合ƈ唯一个字W串Qdelimiter 参数是设定在各个元素间加入新的字W串?
Lcase(string) 字W串转换为小写字体?
Left(string, length) 由字W串左边开始取得length 参数讑֮长度的字W?
Len(string) 取得字符串的长度?
Log(number) 取得数值的自然Ҏ?
Ltrim(string) L字符串的左边I白部分?
Mid(string, start[, length]) 取出字符串中strat 参数讑֮的字W后length 长度的字W串Q若length 参数没有讑֮Q则取回start 以后全部的字W?
Minute(time) 取得旉内容的分部分Q型态ؓInteger?
MkDir(path) 建立一个新的目录?
Month(date) 取得日期的月部分Q型态ؓInteger?
FormatDateTime(date[,namedformat]) 传回格式化的日期或时间数据?
FormatNumber(expression[,numdigitsafterdecimal [,includeleadingdigit]]) 传回格式?
的数值数据。Numdigitsafterdecimal 参数为小数字敎ͼincludeleadingdigit 参数为当整数? 时是否补x数字数?
FormatPercent(expression[,numdigitsafterdecimal [,includeleadingdigit]]) 传回转换为百分比格式的数值数据。numdigitsafterdecimal 参数为小数字敎ͼincludeleadingdigit 参数为当整数? 时是否补x数字数?
GetAttr(filename) 传回档案或目录的属性倹{?
Hex(number) 数值参数{换ؓ16 q制倹{?
Hour(time) 传回旉的小时字D,型态是Integer?
Iif(expression, truepart, falsepart) 当表辑ּ的传回gؓTrue 时执行truepart 字段的程序,反之则执行falsepart 字段?
InStr([start, ]string1, string2) 搜寻string2 参数讑֮的字W出现在字符串的W几个字W,start 为由W几个字W开始寻找,string1 为欲搜寻的字W串Qstring2 为欲搜寻的字W?
Int(number) 传回于或等于接收参数的最大整数倹{?
IsArray(varname) 判断一个变量是否ؓ数组型态,若ؓ数组则传回TrueQ反之则为False?
Day(datetime) 依接收的日期参数传回日?
Eof(filenumber) 当抵达一个被开启的档案l尾时会传回True?
Exp(number) 依接收的参数传回e 的次方倹{?
FileDateTime(pathname) 传回档案建立时的日期、时间?
FileLen(pathname) 传回档案的长度,单位是Byte?
Filter(sourcearray, match[, include[, compare]]) 搜寻字符串数l中的指定字W串Q凡是数l元素中含有指定字符Ԍ会将它们l合成新的字W串数组q传回。若是要传回不含指定字符串的数组元素Q则include 参数设ؓFalse?compare 参数则是讑֮搜寻时是否区分大写Q此时只要给TextCompare 常数? 卛_?
Fix(number) L参数的小数部分ƈ传回?
Format(expression[, style[, firstdayofweek[, firstweekofyear]]]) 日期、时间和数D料{为每个国安可以接受的格式?
FormatCurrency(expression[,numdigitsafterdecimal [,includeleadingdigit]]) 数DZؓ金额型态?
numdigitsafterdecimal 参数为小数字敎ͼincludeleadingdigit 参数为当整数? 时是否补x数字数?
CObj(expression) 转换表达式ؓObject 型态?
CShort(expression) 转换表达式ؓShort 型态?
CSng(expression) 转换表达式ؓSingle 型态?
CStr(expression) 转换表达式ؓString 型态?
Choose (index, choice-1[, choice-2, ... [, choice-n]]) 以烦引值来选择q传回所讑֮的参数?
Chr(charcode) 以ASCII 码来取得字符内容?
Close(filenumberlist) l束使用Open 开启的档案?
Cos(number) 取得一个角度的余u倹{?
Ctype(expression, typename) 转换表达式的型态?
DateAdd(dateinterval, number, datetime) Ҏ期或旉作加减?
DateDiff(dateinterval, date1, date2) 计算两个日期或时间间的差倹{?
DatePart (dateinterval, date) 依接收的日期或时间参C回年、月、日或时间?
DateSerial(year, month, day) 接收的参数合ƈZ个只有日期的Date 型态的数据?
Datevalue(datetime) 取得W合国别讑֮样式的日期|q包含时间?
Abs(number) 取得数值的l对倹{?
Asc(String) 取得字符串表辑ּ的第一个字WASCII 码?
Atn(number) 取得一个角度的反正切倹{?
CallByName (object, procname, usecalltype,[args()]) 执行一个对象的Ҏ、设定或传回对象的属性?
CBool(expression) 转换表达式ؓBoolean 型态?
CByte(expression) 转换表达式ؓByte 型态?
CChar(expression) 转换表达式ؓ字符型态?
CDate(expression) 转换表达式ؓDate 型态?
CDbl(expression) 转换表达式ؓDouble 型态?
CDec(expression) 转换表达式ؓDecimal 型态?
CInt(expression) 转换表达式ؓInteger 型态?
CLng(expression) 转换表达式ؓLong 型?

]]>
自己在一个项目用到的DBUntilc?/title><link>http://www.aygfsteel.com/yuanhuaming/archive/2006/06/09/51663.html</link><dc:creator>疯流成?/dc:creator><author>疯流成?/author><pubDate>Fri, 09 Jun 2006 04:24:00 GMT</pubDate><guid>http://www.aygfsteel.com/yuanhuaming/archive/2006/06/09/51663.html</guid><wfw:comment>http://www.aygfsteel.com/yuanhuaming/comments/51663.html</wfw:comment><comments>http://www.aygfsteel.com/yuanhuaming/archive/2006/06/09/51663.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/yuanhuaming/comments/commentRss/51663.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/yuanhuaming/services/trackbacks/51663.html</trackback:ping><description><![CDATA[ <p> <br />先看?a target="_blank" ?=""><font color="#003399">INETA</font></a>牛hStephen Walther的比较测试结?希望对大家有?/p> <ul> <li>DataReadear比DataSet?5% </li> <li>SqlDataReader比OleDbDataReader?0% </li> <li>用DataReader的ASP风格的表格显C比DataGridl定DataReader?0% </li> <li>用Ordinal的DataReader讉K字段比用名字讉K?5% </li> <li>DataGrid中用AutoGenerateColumns=true比用昑ּl定?4% </li> <li>量用缓?/li> </ul> <p>试׃比较局限,所以不一定很准确Q但可以做个参考?br /></p> <div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"> <span style="COLOR: #0000ff">Imports</span> <span style="COLOR: #000000"> System.Data.OleDb<br /><br /><br /></span> <span style="COLOR: #0000ff">Public</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #0000ff">Class</span> <span style="COLOR: #000000"> ComDataBase<br /><br />    </span> <span style="COLOR: #0000ff">Private</span> <span style="COLOR: #000000"> LsConn </span> <span style="COLOR: #0000ff">As</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #0000ff">String</span> <span style="COLOR: #000000">         <br /></span> <span style="COLOR: #000000">    </span> <span style="COLOR: #0000ff">Private</span> <span style="COLOR: #000000"> LoleConn </span> <span style="COLOR: #0000ff">As</span> <span style="COLOR: #000000"> OleDbConnection         </span> <span style="COLOR: #008000"> <br /> </span> <span style="COLOR: #000000">    </span> <span style="COLOR: #0000ff">Private</span> <span style="COLOR: #000000"> LoleTrans </span> <span style="COLOR: #0000ff">As</span> <span style="COLOR: #000000"> OleDbTransaction        </span> <span style="COLOR: #000000"> <br /> </span> <span style="COLOR: #008000"> <br /> </span> <span style="COLOR: #000000">    </span> <span style="COLOR: #0000ff">Public</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #0000ff">Sub</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #0000ff">New</span> <span style="COLOR: #000000">()<br />        </span> <span style="COLOR: #0000ff">Dim</span> <span style="COLOR: #000000"> bOracle </span> <span style="COLOR: #0000ff">As</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #0000ff">Boolean</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #0000ff">False</span> <span style="COLOR: #000000"> <br />        </span> <span style="COLOR: #0000ff">Dim</span> <span style="COLOR: #000000"> oIni </span> <span style="COLOR: #0000ff">As</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #0000ff">New</span> <span style="COLOR: #000000"> ComIniFile(</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">..\INI\CCCC001.ini</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">)<br /><br />        </span> <span style="COLOR: #0000ff">If</span> <span style="COLOR: #000000"> (oIni.GetValue(</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">DB</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">, </span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">DBTYPE</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">) </span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">ORACLE</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">) </span> <span style="COLOR: #0000ff">Then</span> <span style="COLOR: #000000"> <br />            bOracle </span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #0000ff">True</span> <span style="COLOR: #000000"> <br />        </span> <span style="COLOR: #0000ff">End</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #0000ff">If</span> <span style="COLOR: #000000"> <br /> <br />        </span> <span style="COLOR: #0000ff">Dim</span> <span style="COLOR: #000000"> sServer </span> <span style="COLOR: #0000ff">As</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #0000ff">String</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000"> oIni.GetValue(</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">DB</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">, </span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">SERVERNAME</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">) <br /><br /></span> <span style="COLOR: #000000">        </span> <span style="COLOR: #0000ff">Dim</span> <span style="COLOR: #000000"> sDBName </span> <span style="COLOR: #0000ff">As</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #0000ff">String</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000"> oIni.GetValue(</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">DB</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">, </span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">DBNAME</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">)      </span> <span style="COLOR: #008000"> <br /> </span> <span style="COLOR: #000000">        </span> <span style="COLOR: #0000ff">Dim</span> <span style="COLOR: #000000"> sUser </span> <span style="COLOR: #0000ff">As</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #0000ff">String</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000"> oIni.GetValue(</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">DB</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">, </span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">USER</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">)          </span> <span style="COLOR: #008000"> <br /> </span> <span style="COLOR: #000000">        </span> <span style="COLOR: #0000ff">Dim</span> <span style="COLOR: #000000"> sPsw </span> <span style="COLOR: #0000ff">As</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #0000ff">String</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000"> oIni.GetValue(</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">DB</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">, </span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">PASSWORD</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">)       </span> <span style="COLOR: #008000"> <br /> </span> <span style="COLOR: #000000"> <br />        </span> <span style="COLOR: #0000ff">If</span> <span style="COLOR: #000000"> (bOracle) </span> <span style="COLOR: #0000ff">Then<br /></span> <span style="COLOR: #000000">            LsConn </span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">Provider=OraOLEDB.Oracle;Data Source=</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #000000">&</span> <span style="COLOR: #000000"> sDBName _<br />                    </span> <span style="COLOR: #000000">&</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">;User Id=</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #000000">&</span> <span style="COLOR: #000000"> sUser </span> <span style="COLOR: #000000">&</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">;Password=</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #000000">&</span> <span style="COLOR: #000000"> sPsw </span> <span style="COLOR: #000000">&</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">;OLEDB.NET=true</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000"> <br />        </span> <span style="COLOR: #0000ff">Else</span> <span style="COLOR: #000000"> <br />            </span> <span style="COLOR: #000000">LsConn </span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">Provider=sqloledb;Data Source=</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #000000">&</span> <span style="COLOR: #000000"> sServer </span> <span style="COLOR: #000000">&</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">;Initial Catalog=</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000"> _<br />                     </span> <span style="COLOR: #000000">&</span> <span style="COLOR: #000000"> sDBName </span> <span style="COLOR: #000000">&</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">;User Id=</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #000000">&</span> <span style="COLOR: #000000"> sUser </span> <span style="COLOR: #000000">&</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">;Password=</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #000000">&</span> <span style="COLOR: #000000"> sPsw </span> <span style="COLOR: #000000">&</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">;</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000"> <br />        </span> <span style="COLOR: #0000ff">End</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #0000ff">If</span> <span style="COLOR: #000000"> <br /> <br />    </span> <span style="COLOR: #0000ff">End Sub</span> <span style="COLOR: #000000"> <br /> <br /> </span> <span style="COLOR: #008000">'db open<br /></span> <span style="COLOR: #000000">    </span> <span style="COLOR: #0000ff">Public</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #0000ff">Sub</span> <span style="COLOR: #000000"> Open()<br />        </span> <span style="COLOR: #0000ff">Try</span> <span style="COLOR: #000000"> <br />        </span> <span style="COLOR: #008000"> <br /> </span> <span style="COLOR: #000000">            </span> <span style="COLOR: #0000ff">If</span> <span style="COLOR: #000000"> (</span> <span style="COLOR: #0000ff">Not</span> <span style="COLOR: #000000"> (LoleConn </span> <span style="COLOR: #0000ff">Is</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #0000ff">Nothing</span> <span style="COLOR: #000000">)) </span> <span style="COLOR: #0000ff">Then</span> <span style="COLOR: #000000"> <br />      </span> <span style="COLOR: #000000">                </span> <span style="COLOR: #0000ff">If</span> <span style="COLOR: #000000"> (LoleConn.State </span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000"> ConnectionState.Open) </span> <span style="COLOR: #0000ff">Then</span> <span style="COLOR: #000000"> <br />                    </span> <span style="COLOR: #008000">'</span> <span style="COLOR: #008000">'接続文字列は定義しない文字列</span> <span style="COLOR: #008000"> <br /> </span> <span style="COLOR: #000000">                    </span> <span style="COLOR: #0000ff">If</span> <span style="COLOR: #000000"> (LoleConn.ConnectionString </span> <span style="COLOR: #000000"><></span> <span style="COLOR: #000000"> LsConn) </span> <span style="COLOR: #0000ff">Then</span> <span style="COLOR: #000000"> <br />                        LoleConn.Close()<br />                        LoleConn.ConnectionString </span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000"> LsConn<br />                        LoleConn.Open()<br />                    </span> <span style="COLOR: #0000ff">End</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #0000ff">If</span> <span style="COLOR: #000000"> <br />                </span> <span style="COLOR: #0000ff">Else</span> <span style="COLOR: #000000"> <br />                    </span> <span style="COLOR: #008000">'</span> <span style="COLOR: #008000">'接続文字列は定義しない文字列</span> <span style="COLOR: #008000"> <br /> </span> <span style="COLOR: #000000">                    </span> <span style="COLOR: #0000ff">If</span> <span style="COLOR: #000000"> (LoleConn.ConnectionString </span> <span style="COLOR: #000000"><></span> <span style="COLOR: #000000"> LsConn) </span> <span style="COLOR: #0000ff">Then</span> <span style="COLOR: #000000"> <br />                        LoleConn.ConnectionString </span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000"> LsConn<br />                    </span> <span style="COLOR: #0000ff">End</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #0000ff">If</span> <span style="COLOR: #000000"> <br />                    LoleConn.Open()<br />                </span> <span style="COLOR: #0000ff">End</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #0000ff">If</span> <span style="COLOR: #000000"> <br />            </span> <span style="COLOR: #0000ff">Else</span> <span style="COLOR: #000000"> <br />                LoleConn </span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #0000ff">New</span> <span style="COLOR: #000000"> OleDbConnection(LsConn)<br />                LoleConn.Open()<br />            </span> <span style="COLOR: #0000ff">End</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #0000ff">If</span> <span style="COLOR: #000000"> <br />        </span> <span style="COLOR: #0000ff">Catch</span> <span style="COLOR: #000000"> ex </span> <span style="COLOR: #0000ff">As</span> <span style="COLOR: #000000"> Exception<br />            ComLog.SetErrLog(</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">ComDataBase</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">, </span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">Open</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">, </span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">デーѝヹ{の接Eに失敗しました?/span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #000000">&</span> <span style="COLOR: #000000"> ex.Message)<br />            ComMsgBox.ErrMsg(</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">E-0002</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">)<br />        </span> <span style="COLOR: #0000ff">End</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #0000ff">Try</span> <span style="COLOR: #000000"> <br />    </span> <span style="COLOR: #0000ff">End Sub</span> <span style="COLOR: #000000"> <br /> <br /> </span> <span style="COLOR: #008000"> <br /> </span> <span style="COLOR: #000000">    </span> <span style="COLOR: #0000ff">Public</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #0000ff">Sub</span> <span style="COLOR: #000000"> Close()<br />        </span> <span style="COLOR: #0000ff">Try</span> <span style="COLOR: #000000"> <br />            </span> <span style="COLOR: #008000">'</span> <span style="COLOR: #008000">'データ ソヹ{への接続を閉じす?/span> <span style="COLOR: #008000"> <br /> </span> <span style="COLOR: #000000">            </span> <span style="COLOR: #0000ff">If</span> <span style="COLOR: #000000"> (</span> <span style="COLOR: #0000ff">Not</span> <span style="COLOR: #000000"> (LoleConn </span> <span style="COLOR: #0000ff">Is</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #0000ff">Nothing</span> <span style="COLOR: #000000">)) </span> <span style="COLOR: #0000ff">Then</span> <span style="COLOR: #000000"> <br />                LoleConn.Close()<br />            </span> <span style="COLOR: #0000ff">End</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #0000ff">If</span> <span style="COLOR: #000000"> <br />        </span> <span style="COLOR: #0000ff">Catch</span> <span style="COLOR: #000000"> ex </span> <span style="COLOR: #0000ff">As</span> <span style="COLOR: #000000"> Exception<br />            ComLog.SetErrLog(</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">ComDataBase</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">, </span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">Close</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">, ex.Message)<br />        </span> <span style="COLOR: #0000ff">Finally</span> <span style="COLOR: #000000"> <br />            </span> <span style="COLOR: #008000">'</span> <span style="COLOR: #008000">'対象を解放す?/span> <span style="COLOR: #008000"> <br /> </span> <span style="COLOR: #000000">            </span> <span style="COLOR: #0000ff">If</span> <span style="COLOR: #000000"> (</span> <span style="COLOR: #0000ff">Not</span> <span style="COLOR: #000000"> (LoleConn </span> <span style="COLOR: #0000ff">Is</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #0000ff">Nothing</span> <span style="COLOR: #000000">)) </span> <span style="COLOR: #0000ff">Then</span> <span style="COLOR: #000000"> <br />                LoleConn.Dispose()<br />                LoleConn </span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #0000ff">Nothing</span> <span style="COLOR: #000000"> <br />            </span> <span style="COLOR: #0000ff">End</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #0000ff">If</span> <span style="COLOR: #000000"> <br />        </span> <span style="COLOR: #0000ff">End</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #0000ff">Try</span> <span style="COLOR: #000000"> <br />    </span> <span style="COLOR: #0000ff">End Sub</span> <span style="COLOR: #000000"> <br /> <br /> </span> <span style="COLOR: #008000"> <br /> </span> <span style="COLOR: #000000">    </span> <span style="COLOR: #0000ff">Public</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #0000ff">Sub</span> <span style="COLOR: #000000"> BeginTrans()<br />        </span> <span style="COLOR: #008000">'</span> <span style="COLOR: #008000">'トラミ낶クションを開始す?/span> <span style="COLOR: #008000"> <br /> </span> <span style="COLOR: #000000">        LoleTrans </span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000"> LoleConn.BeginTransaction()<br />    </span> <span style="COLOR: #0000ff">End Sub</span> <span style="COLOR: #000000"> <br /> <br /> </span> <span style="COLOR: #008000"> <br /> </span> <span style="COLOR: #000000">    </span> <span style="COLOR: #0000ff">Public</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #0000ff">Sub</span> <span style="COLOR: #000000"> Commit()<br />        Execute(</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">Delete ゗テム理 where 1=2</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">)<br />        </span> <span style="COLOR: #008000">'</span> <span style="COLOR: #008000">'トラミ낶クションの終炏Vマークす?/span> <span style="COLOR: #008000"> <br /> </span> <span style="COLOR: #000000">        LoleTrans.Commit()<br />    </span> <span style="COLOR: #0000ff">End Sub</span> <span style="COLOR: #000000"> <br /> <br /> </span> <span style="COLOR: #008000"> <br /> </span> <span style="COLOR: #000000">    </span> <span style="COLOR: #0000ff">Public</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #0000ff">Sub</span> <span style="COLOR: #000000"> RollBack()<br />        Execute(</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">Delete ゗テム理 where 1=2</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">)<br />        </span> <span style="COLOR: #008000">'</span> <span style="COLOR: #008000">'データ変更を消去する</span> <span style="COLOR: #008000"> <br /> </span> <span style="COLOR: #000000">        LoleTrans.Rollback()<br />    </span> <span style="COLOR: #0000ff">End Sub</span> <span style="COLOR: #000000"> <br /> </span> <span style="COLOR: #008000"> <br /> </span> <span style="COLOR: #000000">    </span> <span style="COLOR: #0000ff">Public</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #0000ff">Function</span> <span style="COLOR: #000000"> GetDataSet(</span> <span style="COLOR: #0000ff">ByVal</span> <span style="COLOR: #000000"> sSQL </span> <span style="COLOR: #0000ff">As</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #0000ff">String</span> <span style="COLOR: #000000">) </span> <span style="COLOR: #0000ff">As</span> <span style="COLOR: #000000"> DataSet<br />        </span> <span style="COLOR: #0000ff">Dim</span> <span style="COLOR: #000000"> oleAdapter </span> <span style="COLOR: #0000ff">As</span> <span style="COLOR: #000000"> OleDbDataAdapter<br />        </span> <span style="COLOR: #0000ff">Dim</span> <span style="COLOR: #000000"> oDataSet </span> <span style="COLOR: #0000ff">As</span> <span style="COLOR: #000000"> DataSet </span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #0000ff">New</span> <span style="COLOR: #000000"> DataSet<br /><br />        </span> <span style="COLOR: #0000ff">Try</span> <span style="COLOR: #000000"> <br />            </span> <span style="COLOR: #0000ff">Dim</span> <span style="COLOR: #000000"> oleCommand </span> <span style="COLOR: #0000ff">As</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #0000ff">New</span> <span style="COLOR: #000000"> OleDbCommand(sSQL, LoleConn)<br />            oleCommand.Transaction </span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000"> LoleTrans<br />            oleAdapter </span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #0000ff">New</span> <span style="COLOR: #000000"> OleDbDataAdapter(oleCommand)<br />            oleAdapter.Fill(oDataSet)               </span> <span style="COLOR: #008000">'</span> <span style="COLOR: #008000">'SQL文を検烦する</span> <span style="COLOR: #008000"> <br /> </span> <span style="COLOR: #000000">        </span> <span style="COLOR: #0000ff">Finally</span> <span style="COLOR: #000000"> <br />            oleAdapter.Dispose()                    </span> <span style="COLOR: #008000">'</span> <span style="COLOR: #008000">'対象を解?/span> <span style="COLOR: #008000"> <br /> </span> <span style="COLOR: #000000">        </span> <span style="COLOR: #0000ff">End</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #0000ff">Try</span> <span style="COLOR: #000000"> <br />        </span> <span style="COLOR: #0000ff">Return</span> <span style="COLOR: #000000"> oDataSet<br />    </span> <span style="COLOR: #0000ff">End Function</span> <span style="COLOR: #000000"> <br /> <br /> </span> <span style="COLOR: #008000"> <br /> </span> <span style="COLOR: #000000">    </span> <span style="COLOR: #0000ff">Public</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #0000ff">Function</span> <span style="COLOR: #000000"> Query(</span> <span style="COLOR: #0000ff">ByVal</span> <span style="COLOR: #000000"> sSQL </span> <span style="COLOR: #0000ff">As</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #0000ff">String</span> <span style="COLOR: #000000">) </span> <span style="COLOR: #0000ff">As</span> <span style="COLOR: #000000"> OleDbDataReader<br />        </span> <span style="COLOR: #0000ff">Dim</span> <span style="COLOR: #000000"> oleCommand </span> <span style="COLOR: #0000ff">As</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #0000ff">New</span> <span style="COLOR: #000000"> OleDbCommand(sSQL, LoleConn)<br />        </span> <span style="COLOR: #0000ff">Try</span> <span style="COLOR: #000000"> <br />            oleCommand.Transaction </span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000"> LoleTrans<br />            </span> <span style="COLOR: #0000ff">Return</span> <span style="COLOR: #000000"> oleCommand.ExecuteReader()       </span> <span style="COLOR: #008000">'</span> <span style="COLOR: #008000">'SQL文を検烦する</span> <span style="COLOR: #008000"> <br /> </span> <span style="COLOR: #000000">        </span> <span style="COLOR: #0000ff">Finally</span> <span style="COLOR: #000000"> <br />            oleCommand.Dispose()                    </span> <span style="COLOR: #008000">'</span> <span style="COLOR: #008000">'対象を解?/span> <span style="COLOR: #008000"> <br /> </span> <span style="COLOR: #000000">        </span> <span style="COLOR: #0000ff">End</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #0000ff">Try</span> <span style="COLOR: #000000"> <br />    </span> <span style="COLOR: #0000ff">End Function</span> <span style="COLOR: #000000"> <br /> <br /> </span> <span style="COLOR: #008000"> <br /> </span> <span style="COLOR: #000000">    </span> <span style="COLOR: #0000ff">Public</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #0000ff">Function</span> <span style="COLOR: #000000"> Query(</span> <span style="COLOR: #0000ff">ByVal</span> <span style="COLOR: #000000"> sSQL </span> <span style="COLOR: #0000ff">As</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #0000ff">String</span> <span style="COLOR: #000000">, </span> <span style="COLOR: #0000ff">ByRef</span> <span style="COLOR: #000000"> aryOleDbParameter </span> <span style="COLOR: #0000ff">As</span> <span style="COLOR: #000000"> ArrayList) </span> <span style="COLOR: #0000ff">As</span> <span style="COLOR: #000000"> OleDbDataReader<br />        </span> <span style="COLOR: #0000ff">Dim</span> <span style="COLOR: #000000"> oleCommand </span> <span style="COLOR: #0000ff">As</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #0000ff">New</span> <span style="COLOR: #000000"> OleDbCommand(sSQL, LoleConn)<br />        </span> <span style="COLOR: #0000ff">Dim</span> <span style="COLOR: #000000"> oleParam </span> <span style="COLOR: #0000ff">As</span> <span style="COLOR: #000000"> OleDbParameter<br /><br />        </span> <span style="COLOR: #0000ff">Try</span> <span style="COLOR: #000000"> <br />            oleCommand.Transaction </span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000"> LoleTrans<br /><br />            </span> <span style="COLOR: #0000ff">For</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #0000ff">Each</span> <span style="COLOR: #000000"> oleParam </span> <span style="COLOR: #0000ff">In</span> <span style="COLOR: #000000"> aryOleDbParameter<br />                oleCommand.Parameters.Add(oleParam)<br />            </span> <span style="COLOR: #0000ff">Next</span> <span style="COLOR: #000000"> <br />            </span> <span style="COLOR: #0000ff">Return</span> <span style="COLOR: #000000"> oleCommand.ExecuteReader()       </span> <span style="COLOR: #008000">'</span> <span style="COLOR: #008000">'SQL文を検烦する</span> <span style="COLOR: #008000"> <br /> </span> <span style="COLOR: #000000">        </span> <span style="COLOR: #0000ff">Finally</span> <span style="COLOR: #000000"> <br />            oleCommand.Dispose()                    </span> <span style="COLOR: #008000">'</span> <span style="COLOR: #008000">'対象を解?/span> <span style="COLOR: #008000"> <br /> </span> <span style="COLOR: #000000">        </span> <span style="COLOR: #0000ff">End</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #0000ff">Try</span> <span style="COLOR: #000000"> <br />    </span> <span style="COLOR: #0000ff">End Function</span> <span style="COLOR: #000000"> <br /> <br /> </span> <span style="COLOR: #008000"> <br /> </span> <span style="COLOR: #000000">    </span> <span style="COLOR: #0000ff">Public</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #0000ff">Function</span> <span style="COLOR: #000000"> Execute(</span> <span style="COLOR: #0000ff">ByVal</span> <span style="COLOR: #000000"> sSQL </span> <span style="COLOR: #0000ff">As</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #0000ff">String</span> <span style="COLOR: #000000">) </span> <span style="COLOR: #0000ff">As</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #0000ff">Integer</span> <span style="COLOR: #000000"> <br />        </span> <span style="COLOR: #0000ff">Dim</span> <span style="COLOR: #000000"> oleCommand </span> <span style="COLOR: #0000ff">As</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #0000ff">New</span> <span style="COLOR: #000000"> OleDbCommand(sSQL, LoleConn)   </span> <span style="COLOR: #008000">'</span> <span style="COLOR: #008000">'OleDbCommandの新インわVミ낹</span> <span style="COLOR: #008000"> <br /> </span> <span style="COLOR: #000000">        </span> <span style="COLOR: #0000ff">Try</span> <span style="COLOR: #000000"> <br />            oleCommand.Transaction </span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000"> LoleTrans<br />            </span> <span style="COLOR: #0000ff">Return</span> <span style="COLOR: #000000"> oleCommand.ExecuteNonQuery()     </span> <span style="COLOR: #008000"> <br /> </span> <span style="COLOR: #000000">        </span> <span style="COLOR: #0000ff">Finally</span> <span style="COLOR: #000000"> <br />            oleCommand.Dispose()                    </span> <span style="COLOR: #000000">       <br />        </span> <span style="COLOR: #0000ff">End</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #0000ff">Try</span> <span style="COLOR: #000000"> <br />    </span> <span style="COLOR: #0000ff">End Function</span> <span style="COLOR: #000000"> <br /> <br /> </span> <span style="COLOR: #008000"> <br /> </span> <span style="COLOR: #000000">    </span> <span style="COLOR: #0000ff">Public</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #0000ff">Function</span> <span style="COLOR: #000000"> Execute(</span> <span style="COLOR: #0000ff">ByVal</span> <span style="COLOR: #000000"> sSQL </span> <span style="COLOR: #0000ff">As</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #0000ff">String</span> <span style="COLOR: #000000">, </span> <span style="COLOR: #0000ff">ByRef</span> <span style="COLOR: #000000"> aryOleDbParameter </span> <span style="COLOR: #0000ff">As</span> <span style="COLOR: #000000"> ArrayList) </span> <span style="COLOR: #0000ff">As</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #0000ff">Integer</span> <span style="COLOR: #000000"> <br />        </span> <span style="COLOR: #0000ff">Dim</span> <span style="COLOR: #000000"> oleCommand </span> <span style="COLOR: #0000ff">As</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #0000ff">New</span> <span style="COLOR: #000000"> OleDbCommand(sSQL, LoleConn)   </span> <span style="COLOR: #008000"> <br /> </span> <span style="COLOR: #000000">        </span> <span style="COLOR: #0000ff">Dim</span> <span style="COLOR: #000000"> oleParam </span> <span style="COLOR: #0000ff">As</span> <span style="COLOR: #000000"> OleDbParameter<br />        </span> <span style="COLOR: #0000ff">Try</span> <span style="COLOR: #000000"> <br />            oleCommand.Transaction </span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000"> LoleTrans<br /><br />            </span> <span style="COLOR: #0000ff">For</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #0000ff">Each</span> <span style="COLOR: #000000"> oleParam </span> <span style="COLOR: #0000ff">In</span> <span style="COLOR: #000000"> aryOleDbParameter<br />                oleCommand.Parameters.Add(oleParam)<br />            </span> <span style="COLOR: #0000ff">Next</span> <span style="COLOR: #000000"> <br /> <br />            </span> <span style="COLOR: #0000ff">Return</span> <span style="COLOR: #000000"> oleCommand.ExecuteNonQuery()     </span> <span style="COLOR: #008000"> <br /> </span> <span style="COLOR: #000000">        </span> <span style="COLOR: #0000ff">Finally</span> <span style="COLOR: #000000"> <br />            oleCommand.Dispose()  <br /></span> <span style="COLOR: #000000"> <br />        </span> <span style="COLOR: #0000ff">End</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #0000ff">Try</span> <span style="COLOR: #000000"> <br />    </span> <span style="COLOR: #0000ff">End Function</span> <span style="COLOR: #000000"> <br /> </span> </div> <p>基本功能都有了,对于项目而言Q这个类够用了?br /> </p> <img src ="http://www.aygfsteel.com/yuanhuaming/aggbug/51663.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/yuanhuaming/" target="_blank">疯流成?/a> 2006-06-09 12:24 <a href="http://www.aygfsteel.com/yuanhuaming/archive/2006/06/09/51663.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>转一封装ADO的代?/title><link>http://www.aygfsteel.com/yuanhuaming/archive/2006/06/09/51639.html</link><dc:creator>疯流成?/dc:creator><author>疯流成?/author><pubDate>Fri, 09 Jun 2006 03:11:00 GMT</pubDate><guid>http://www.aygfsteel.com/yuanhuaming/archive/2006/06/09/51639.html</guid><wfw:comment>http://www.aygfsteel.com/yuanhuaming/comments/51639.html</wfw:comment><comments>http://www.aygfsteel.com/yuanhuaming/archive/2006/06/09/51639.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/yuanhuaming/comments/commentRss/51639.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/yuanhuaming/services/trackbacks/51639.html</trackback:ping><description><![CDATA[     摘要: using  System; using  System.Collections; using  System.Collections.Specialized; using  System.Runtime.Remoting.Messaging; using  System.Data; using ...  <a href='http://www.aygfsteel.com/yuanhuaming/archive/2006/06/09/51639.html'>阅读全文</a><img src ="http://www.aygfsteel.com/yuanhuaming/aggbug/51639.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/yuanhuaming/" target="_blank">疯流成?/a> 2006-06-09 11:11 <a href="http://www.aygfsteel.com/yuanhuaming/archive/2006/06/09/51639.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>关于DataGrid分页问题 http://www.aygfsteel.com/yuanhuaming/archive/2005/08/16/10278.html疯流成?/dc:creator>疯流成?/author>Tue, 16 Aug 2005 10:21:00 GMThttp://www.aygfsteel.com/yuanhuaming/archive/2005/08/16/10278.htmlhttp://www.aygfsteel.com/yuanhuaming/comments/10278.htmlhttp://www.aygfsteel.com/yuanhuaming/archive/2005/08/16/10278.html#Feedback0http://www.aygfsteel.com/yuanhuaming/comments/commentRss/10278.htmlhttp://www.aygfsteel.com/yuanhuaming/services/trackbacks/10278.html       一会儿Q我找到答案了Q错错在我太相信VS.NET的智能了。dataGrid虽然提供了翻늚功能Q但是不太智能,需要你通过一个事件把新页讄成当q页?BR>
q是datashow昄部分Q注意一定要?lt;form>?BR><asp:datagrid id="dataShow" Runat="server" OnPageIndexChanged="dataShow_Changed" AllowPaging=True PageSize=2 PagerStyle-HorizontalAlign=Right Width=100%></asp:datagrid>

代码如下Q?BR>
    OleDbConnection conn;
        
string strcon;
        
string strcmd;
        
protected System.Web.UI.WebControls.Label label1;
        OleDbDataAdapter cmd;
        DataSet ds;
        
private void Page_Load(object sender, System.EventArgs e)
        
{
                strcon
="Provider=microsoft.jet.oledb.4.0;data source=c:\\inetpub\\wwwroot\\Flowers\\FlowerDB.mdb";
                conn
=new OleDbConnection(strcon);
                strcmd
="select FlowerName,FlowerPrice from Flowers where FlowerTypeID=(select FlowerTypeID from FlowerType where FlowerTypeName=@name)";
                cmd
=new OleDbDataAdapter(strcmd,conn);
                cmd.SelectCommand.Parameters.Add(
new OleDbParameter("@name", OleDbType.Char,80));
                cmd.SelectCommand.Parameters[
"@name"].Value=Session["name"];
                ds
=new DataSet();
                cmd.Fill(ds,
"Flowers");    
                dataShow.DataSource
=ds.Tables["Flowers"].DefaultView;    
                dataShow.DataBind();
                label1.Text
="一共有" +ds.Tables["Flowers"].Rows.Count.ToString()+"条记录?/SPAN>";

        }

//q个事g是当用户选择改变当前늚索引Ӟ把新页的烦引作为当前页的烦引,同时需要再ơ绑?/SPAN>
        public void dataShow_Changed(Object sender, DataGridPageChangedEventArgs e)
        
{
            dataShow.CurrentPageIndex 
= e.NewPageIndex;
            dataShow.DataBind();
            
        }





]]>
ADO.NET学习W记2http://www.aygfsteel.com/yuanhuaming/archive/2005/08/16/10242.html疯流成?/dc:creator>疯流成?/author>Tue, 16 Aug 2005 08:36:00 GMThttp://www.aygfsteel.com/yuanhuaming/archive/2005/08/16/10242.htmlhttp://www.aygfsteel.com/yuanhuaming/comments/10242.htmlhttp://www.aygfsteel.com/yuanhuaming/archive/2005/08/16/10242.html#Feedback0http://www.aygfsteel.com/yuanhuaming/comments/commentRss/10242.htmlhttp://www.aygfsteel.com/yuanhuaming/services/trackbacks/10242.html    要实现通过控g来访问数据库数据Q必M数据库检索数据。数据绑定是检索到的数据与昄该数据的控gq行链接的过E。用数据绑定表辑ּ可将数据l定到所有类型的控g中。用DataSource属性可以将数据l定到复杂控件中Q如DataList,DataGrid.....Q不q今天主要讲如何使用l定式)
    可以从各cd的数据执行数据绑定操作,如:

1.单属?BR>

<%@Import Namespace=System.Web.UI.WebControls %>
<%@Import Namespace=System %>
<HTML>
 
<HEAD>
  
<title>test</title>
  
<script language="C#" runat="server">
  
void Txt_Changed(Object sender,EventArgs e)
  
{
   Page.DataBind();
  }

  
</script>
 
</HEAD>
 
<body>
 
<form id=form1 runat=server>
  
<asp:TextBox ID="txtBox" OnTextChanged="Txt_Changed" Runat="server"/>
  
<br>
  
<asp:Label ID=lblShow  Runat=server><%# txtBox.Text %></asp:Label>
 
</form>
 
</body>
</HTML>

2.集合        //已经在上ơ讲q了Q就是将数据l定到ArrayList中的例子
3.表达?BR>4.Ҏ调用的结?BR>
<%@Import Namespace=System %>
<%@Import Namespace=System.Web.UI.WebControls %>
<%@Import Namespace=System.Data %>
<HTML>
 
<HEAD>
  
<title>test</title>
  
<script language="C#" runat="server">
  
void Page_Load(Object sender,EventArgs e)
  
{
   
if(!IsPostBack)
   
{
    DataTable dt
=new DataTable("num");
    dt.Columns.Add(
new DataColumn("数字",typeof(Int32)));
    DataRow dr;
    
for(int i=0;i<10;i++)
    
{
     dr
=dt.NewRow();
     dr[
0]=i;     
     dt.Rows.Add(dr);
    }
   
    DataView.DataSource
=dt;
    DataView.DataBind();
   }

  }

  String square(
int a)
  
{
   
int num=a*a;
   
return num.ToString();//q回cd是stringQ所以要转类?/SPAN>
  }

  
</script>
 
</HEAD>
 
<body>
  
<form id="form1" runat="server">
  
<asp:DataList ID=DataView Runat=server>
  
<!--  ItemTemplate其实是DataList中的模板Q功能是为数据集合中的每一行呈Cơ。还有其它模板请看MSDN-->
   
<ItemTemplate>
   
<!-- 
   下面既采用了表达式,有用了方法调用。还介绍了DataBinder.Eval()ҎQ有3个参敎ͼ
   1。数据项的命名容器:Container.DataItem
   2。数据字D名(列名)
   3。格式字W串Q可?nbsp;  
-->
    数字Q?/SPAN><%# DataBinder.Eval(Container.DataItem,"数字"%>
    qxQ?/SPAN><%# square((int)DataBinder.Eval(Container.DataItem,"数字")) %>
   
</ItemTemplate>
  
</asp:DataList>
  
</form>
 
</body>
</HTML>




]]>
ADO.NET学习W记1http://www.aygfsteel.com/yuanhuaming/archive/2005/08/16/10239.html疯流成?/dc:creator>疯流成?/author>Tue, 16 Aug 2005 08:31:00 GMThttp://www.aygfsteel.com/yuanhuaming/archive/2005/08/16/10239.htmlhttp://www.aygfsteel.com/yuanhuaming/comments/10239.htmlhttp://www.aygfsteel.com/yuanhuaming/archive/2005/08/16/10239.html#Feedback0http://www.aygfsteel.com/yuanhuaming/comments/commentRss/10239.htmlhttp://www.aygfsteel.com/yuanhuaming/services/trackbacks/10239.htmlADO.NET拥有2大核心组Ӟ
a.DataSet
b..net数据提供E序

其中DataSet不与数据库交互,它只是一个数据容器。与数据库打交道的式.net数据提供E序?/P>

下面我门来看3D代码:

1.如何把表d到DataSet?BR>

 DataSet ds=new DataSet();
 DataTable dt
=new DataTable("num");
 dt.Columns.Add(
new DataColumn("数字",typeof(Int32)));
 dt.Columns.Add(
new DataColumn("qx",typeof(Int32)));
 DataRow dr;
 
for(int i=0;i<10;i++)
 
{
  dr
=dt.NewRow();
  dr[
0]=i;
  dr[
1]=i*i;
  dt.Rows.Add(dr);
 }

 ds.Tables.Add(dt);
 show.DataSource
=ds.Tables["num"].DefaultView;//show是DataGrid对象
 show.DataBind();



2.DataAdapter对象的?BR>

 string strCon="Data Source=.;uid=sa;pwd=hotman;Initial Catalog=pubs";
 SqlConnection conn
=new SqlConnection(strCon);
 
string strcmd="select *from titles";
// 2U方法检索数?BR>// SqlCommand comm=new SqlCommand(strcmd,conn);
// SqlDataAdapter cmd=new SqlDataAdapter();
// cmd.SelectCommand=comm;

 SqlDataAdapter cmd
=new SqlDataAdapter(strcmd,conn);
 
//在创接之后,必须索数据ƈ用所索的数据填充dataset
 conn.Open();//虽然.NET提供了断开式连接,但是Z提高性能Q最好显式的打开关闭
 DataSet ds=new DataSet();//创徏dataset对象
 cmd.Fill(ds,"titles");
 show.DataSource
=ds.Tables["titles"].DefaultView;
 show.DataBind();
 conn.Close();




 3.SqlDataReader对象的?/P>

 // DataReader是查询结果的一U只读访?BR> //优点是大大加快了讉K数据的速度
 
//不提供断开式访?/SPAN>
 string strCon="Data Source=.;uid=sa;pwd=hotman;Initial Catalog=pubs";
 
string strcmd="select *from titles";
 SqlConnection conn
=new SqlConnection(strCon);
 SqlCommand cmd
=new SqlCommand(strcmd,conn);
 conn.Open();   
 SqlDataReader reader
=cmd.ExecuteReader();
 show.DataSource
=reader;
 show.DataBind();
 conn.Close();


 

 



]]>
վ֩ģ壺 ɽ| | | Ž| ̴| | | | | | | ³ľ| | | ӻ| ӽ| ʡ| | | | | ױ| | Դ| ̨| | | | Դ| ƽ| Ԫı| | | | | | ˼| ʡ| | | ˳|