DB="dbdatareader/gxsj-mdb.m...

您还未登陆,请登录后操作!
VB查询排序问题
Data1.RecordSource = &select*from zmb where [司机]=& + &&& + nospace(Combo5.Text) + &&&
以上是按字段(司机)来查找,其中zmb是名称,nospace(combo5.text)是去掉空格后的司机姓名。实现查找没问题,请教如何使查到的记录按数据表中&时间&这个字段排序显示结果。
期待高手的指点
谢谢
sql = "select * from zmb where [司机]=" + "'" + nospace(Combo5.Text) + "' order by 时间"
Data1.RecordSource = sql
回答数:967enctype=&multipart/form-data&中Form参数的获取_小组_ThinkSAAS
enctype=&multipart/form-data&中Form参数的获取
enctype=&multipart/form-data&中Form参数的获取
如果表单使用enctype="multipart/form-data"方式提交,
那么一般的request.getParameter(arg0)方法是无法获取Form参数的,
发现使用apache的common-fileupload组件可以获取,
DiskFileUpload upload = new DiskFileUpload();
upload.setHeaderEncoding("UTF-8");
List items = upload.parseRequest(request);
Iterator iter = items.iterator();
while (iter.hasNext()) {
FileItem item = (FileItem) iter.next();
if (item.isFormField()) {
item.getFieldName();
item.getString("UTF-8");
}catch (Exception ex) {
注意,如果不能使用item.getString(),然后自行转换编码,
这样会出现乱码的,
new String(item.getString().getBytes(),"UTF-8")
这样会出现乱码
试了很多方法,这是目前发现唯一能解决乱码问题的方法
用户评论(0)
开发技术学习小组列表
PHP开发框架
缓存Memcache
服务器环境
ThinkSAAS商业授权:
ThinkSAAS为用户提供有偿个性定制开发服务
ThinkSAAS将为商业授权用户提供二次开发指导和技术支持
手机客户端
ThinkSAAS接收任何功能的Iphone(IOS)和Android手机的客户端定制开发服务
让ThinkSAAS更好,把建议拿来。
iphone扫码下载客户端IBM Connecting to DB2 z/OS v10 with Data Studio v4.1 or InfoSphere Data Architect v9.1 results in SQL error code -4499 or -1224 - United States
Technote (troubleshooting)
Problem(Abstract)
The program fix (PTF) UK91146 must be applied to the DB2 z/OS v10 data server that you want to connect to with the database clients.
If you are having connection issues when you attempt to connect to a DB2 z/OS v10 data server with the database clients, you might see the following symptoms:
The following abend occurs on the DB2 z/OS server: 0c4-,loc=dsnlzllm.dsnlzinf+0974
In the database clients, the connection attempt fails and you might receive the following SQL error codes: -4499 or -1224
The database clients use the IBM Data Server Driver for JDBC and SQLJ to establish connections to DB2 z/OS data servers. The version of the IBM Data Server Driver for JDBC and SQLJ that is bundled with the Data Studio v4.1 client and InfoSphere Data Architect v9.1 requires that the program fix (PTF) UK91146 is applied to the DB2 z/OS data server.
The IBM Data Server Driver for JDBC and SQLJ is operating at a higher DRDA level, so when the database clients attempt to connect to the DB2 for z/OS data server, an internal processing error occurs in the DB2 10 for z/OS data server. For example, SQLAM 11 or higher will cause connection errors with DB2 10 for z/OS data servers unless PTF UK91146 is applied on the data server.
For details about this connection error, see Hiper APAR 79161 at .
Resolving the problem
To resolve the connection error:
Verify that the following abend was issued on the DB2 z/OS v10 data server: 0c4-,loc=dsnlzllm.dsnlzinf+0974
Apply PTF UK91146 to the DB2 z/OS v10 data server.
Related information
Cross reference information
Information Management
InfoSphere Data Architect
Not Applicable
Linux, Windows
All Editions
Rate this page:
(0 users)Average rating
(0 users)Average rating
Document information
More support for:
Software version:
Operating system(s):
Linux, Windows
Reference #:
Modified date:
Translate my page
Machine Translation
Machine Translation有没有解决当FORM的ENCTYPE=&multipart/form-data& 时request.getParameter()获取不到值的
&来源:读书人网&【读书人网():综合教育门户网站】
有没有解决当FORM的ENCTYPEmultipart/form-data 时request.getParameter()获取不到值的方法?我用的是js
有没有解决当FORM的ENCTYPE=&multipart/form-data& 时request.getParameter()获取不到值的方法?我用的是jspSmartUpload组件,我的代码是这样:
&form & name= &form3 & & action= &Image & & ENCTYPE= &multipart/form-data & &
& method= &post &&
& border= & &&
& 标签号:
&input & type= &text & & name= &id & & value= & &&
&td& 上传图片: &/td&
&td & colspan= &2 &&
&input & name= &imgfile & & type= &file & & id= &imgfile & & size= &40 & & onchange= &viewmypic(showimg,this.form.imgfile); & & /&
&input & type=hidden & name= &id1 & & value= & &&
&input & name= &button1 & & type= &submit & & value= &上传 &&
我想把imgfile和id一起传到servlet中可是id=null.
我用了这样的方法 &
& SmartUpload & uploader=new & SmartUpload();
& String & id & =uploader.getRequest().getParameter( &id &);
可是还是不行!!!请老大们教我。[解决办法]刚刚遇上这样的问题~~~up[解决办法]用url重写可以实现 [解决办法]HttpSmartUpload uploader=new HttpSmartUpload();
好像是 回家给你查查[解决办法]还有这种事啊,学习,我一直用struts里自带的方法[解决办法]晕。。。。。楼上的楼上。。
你别乱搞,OK?[解决办法]试试用session来处理 [解决办法]我刚在做公司一个项目上传这块,建议你去看看例子,不是很难
/article.asp?id=115
你在接request的时候最好不要用selvet处理,直接用另一个jsp页面处理就好了[解决办法]主要是Form中的ENCTYPE= &multipart/form-data &这个的原因,这么设置getParameter方法就取不到值,我也正在寻找解决的办法,
我用的是FileUpload组件,和你遇到同样的问题,等待高手解答!
顶下[解决办法]可以在页面里使用 &%request.setAttribute( & &,value)%&
因为那个属性ENCTYPE= &multipart/form-data &是不能接受字符流的[解决办法]我也遇到了跟你一样的问题,但我通过两天的实验解决了,我把总结的经验写到博客里了
http://blog.csdn.net/thinker28754/archive//1626844.aspx[解决办法]用 String cplb=mySmartUpload.getRequest().getParameter( &cplb &);代替原来的String cplb=request.getParameter( &cplb &);就OK了,简单吧!o(∩_∩)o...
我用的是JSP和SMARTUPLOAD上传组件,其他平台下还不知道 [解决办法]ls是正确的方法 可以结帖了~[解决办法]apache fileupload
FileItem item = (FileItem)fileItems.get(0);
String title = item.getString();,下载次数:383 次
| 关键字:
FactoryDB.mdb[172KB]
ArrayExample
BasicExample
FusionCharts.dll[7KB]
DB_dataURL
DB_DrillDown
FusionCharts
FCF_Area2D.swf[19KB]
FCF_Column2D.swf[18KB]
FCF_Column3D.swf[20KB]
FCF_Line.swf[19KB]
FCF_MSColumn3D.swf[21KB]
FCF_MSColumn3DLineDY.swf[23KB]
FCF_Pie3D.swf[10KB]
FCF_StackedColumn3D.swf[21KB]
FusionCharts Free V2.1
FCF_Area2D.swf[19KB]
FCF_Bar2D.swf[18KB]
FCF_Candlestick.swf[18KB]
FCF_Column2D.swf[18KB]
FCF_Column3D.swf[20KB]
FCF_Doughnut2D.swf[16KB]
FCF_Funnel.swf[12KB]
FCF_Gantt.swf[26KB]
FCF_Line.swf[19KB]
FCF_MSArea2D.swf[20KB]
FCF_MSBar2D.swf[19KB]
FCF_MSColumn2D.swf[20KB]
FCF_MSColumn2DLineDY.swf[22KB]
FCF_MSColumn3D.swf[21KB]
FCF_MSColumn3DLineDY.swf[23KB]
FCF_MSLine.swf[20KB]
FCF_Pie2D.swf[16KB]
FCF_Pie3D.swf[10KB]
FCF_StackedArea2D.swf[21KB]
FCF_StackedBar2D.swf[20KB]
FCF_StackedColumn2D.swf[20KB]
FCF_StackedColumn3D.swf[21KB]
ArrayExample
BasicExample
FactoryDB.mdb[172KB]
DB_dataURL
DB_DrillDown
DemoLinkPages
FusionCharts
FCF_Area2D.swf[19KB]
FCF_Column2D.swf[18KB]
FCF_Column3D.swf[20KB]
FCF_Line.swf[19KB]
FCF_MSColumn3D.swf[21KB]
FCF_MSColumn3DLineDY.swf[23KB]
FCF_Pie3D.swf[10KB]
FCF_StackedColumn3D.swf[21KB]
JavaScript
ChartChange
ClientSideData
ArrayExample
Combination.jsp[4KB]
MultiSeries.jsp[4KB]
SingleSeries.jsp[3KB]
Stacked.jsp[4KB]
BasicExample
BasicChart.jsp[1KB]
BasicDataXML.jsp[2KB]
dataXML.jsp[3KB]
MultiChart.jsp[3KB]
SimpleChart.jsp[2KB]
BasicDBExample.jsp[4KB]
BasicDBExampleUsingConnectionClass.jsp[5KB]
DB_dataURL
Default.jsp[2KB]
PieData.jsp[3KB]
DB_DrillDown
Default.jsp[4KB]
Detailed.jsp[4KB]
Default.jsp[11KB]
Deployable
FusionChartsFree_JSP.war[216KB]
Chart.jsp[3KB]
Default.jsp[2KB]
DBConn.jsp[1KB]
FusionChartsHTMLRenderer.jsp[3KB]
FusionChartsRenderer.jsp[3KB]
MANIFEST.MF[39B]
SourceCode
fusioncharts
DBConnection.java[2KB]
FusionChartsHelper.java[4KB]
infosoftglobal
fusioncharts
DBConnection.java[2KB]
FusionChartsHelper.java[4KB]
fusioncharts
infosoftglobal
fusioncharts
index-files
inherit.gif[57B]
package-list[45B]
UTF8Example
FrenchDBExample.jsp[2KB]
FrenchXMLFileExample.jsp[2KB]
JapaneseDBExample.jsp[3KB]
JapaneseXMLFileExample.jsp[2KB]
PieDataFrench.jsp[3KB]
PieDataJapanese.jsp[3KB]
fusioncharts
DBConnection.class[1KB]
FusionChartsHelper.class[3KB]
infosoftglobal
fusioncharts
DBConnection.class[1KB]
FusionChartsHelper.class[3KB]
MyFirstChart
ArrayExample
Combination.php[3KB]
MultiSeries.php[3KB]
SingleSeries.php[2KB]
Stacked.php[3KB]
BasicExample
BasicChart.php[1KB]
BasicDataXML.php[2KB]
dataXML.php[2KB]
MultiChart.php[2KB]
SimpleChart.php[1KB]
BasicDBExample.php[2KB]
Default.php[3KB]
Detailed.php[2KB]
DB_dataURL
Default.php[1KB]
PieData.php[1KB]
DB_DrillDown
Default.php[2KB]
Detailed.php[2KB]
Default.php[7KB]
Chart.php[2KB]
Default.php[2KB]
DBConn.php[1KB]
FC_Colors.php[1KB]
FusionCharts.php[7KB]
UTF8Example
FrenchDBExample.php[2KB]
FrenchXMLFileExample.php[1KB]
JapaneseDBExample.php[2KB]
JapaneseXMLFileExample.php[1KB]
PieDataFrench.php[2KB]
PieDataJapanese.php[2KB]
ArrayExample
Combination.php[3KB]
MultiSeries.php[3KB]
SingleSeries.php[2KB]
Stacked.php[3KB]
BasicExample
Data.php[1KB]
CreateChartFromExtData.php[2KB]
FirstChart.php[2KB]
MultiChart.php[2KB]
SimpleChart.php[1KB]
BasicDBExample.php[2KB]
DB_dataURL
Default.php[1KB]
PieData.php[1KB]
DB_DrillDown
Default.php[3KB]
Detailed.php[2KB]
Chart.php[2KB]
Default.php[2KB]
DBConn.php[1KB]
FusionCharts.php[6KB]
FusionCharts_Gen.php[70KB]
UTF8Example
DataFrench.php[1KB]
DataJapanese.php[1KB]
FrenchDBExample.php[2KB]
FrenchXMLFileExample.php[1KB]
JapaneseDBExample.php[2KB]
JapaneseXMLFileExample.php[1KB]
PieDataFrench.php[2KB]
PieDataJapanese.php[2KB]
fusioncharts_helper.rb[10KB]
xml_helper.rb[1KB]
controllers
fusioncharts
array_example_controller.rb[3KB]
basic_example_controller.rb[3KB]
db_data_url_controller.rb[1KB]
db_drilldown_controller.rb[2KB]
db_example_controller.rb[1KB]
db_js_controller.rb[2KB]
form_based_controller.rb[1KB]
index_controller.rb[195B]
utf8_example_controller.rb[6KB]
application.rb[761B]
application_helper.rb[255B]
fusioncharts
factory_master.rb[297B]
factory_output_quantity.rb[260B]
french_factory_master.rb[202B]
japanese_factory_master.rb[199B]
fusioncharts
array_example
combination.html.erb[664B]
combination_data.builder[1KB]
ms_array_data.builder[1KB]
multi_series.html.erb[627B]
single_series.html.erb[622B]
ss_array_data.builder[521B]
stacked.html.erb[836B]
stacked_data.builder[1KB]
basic_example
basic_chart.html.erb[352B]
basic_data_xml.html.erb[756B]
data_xml.html.erb[756B]
multi_chart.html.erb[708B]
sampledata.builder[966B]
simple_chart.html.erb[374B]
db_data_url
default.html.erb[331B]
pie_data.builder[772B]
db_drilldown
default.html.erb[545B]
default_factories_quantity.builder[677B]
detailed.html.erb[926B]
factory_details.builder[721B]
db_example
basic_dbexample.html.erb[650B]
basic_factories_quantity.builder[587B]
default.html.erb[5KB]
factories_quantity.builder[752B]
form_based
chart.html.erb[681B]
default.html.erb[2KB]
form_based_data.builder[705B]
index.html.erb[3KB]
utf8_example
french_dbexample.html.erb[381B]
french_xmlfile_example.html.erb[416B]
japanese_dbexample.html.erb[387B]
japanese_xmlfile_example.html.erb[434B]
pie_data_french.html.erb[483B]
pie_data_japanese.html.erb[511B]
common.html.erb[1KB]
environments
development.rb[808B]
production.rb[823B]
test.rb[973B]
initializers
inflections.rb[362B]
mime_types.rb[205B]
boot.rb[2KB]
database.yml[1KB]
environment.rb[2KB]
routes.rb[1KB]
001_create_factory_masters.rb[226B]
002_create_factory_output_quantities.rb[322B]
003_create_fusioncharts_factory_master_germen.rb[256B]
004_create_fusioncharts_german_factory_masters.rb[259B]
005_create_fusioncharts_french_factory_masters.rb[259B]
ApplicationController.src
ApplicationHelper.src
Fusioncharts
ArrayExampleController.src
BasicExampleController.src
DbDataUrlController.src
DbDrilldownController.src
DbExampleController.src
DbJsController.src
FormBasedController.src
IndexController.src
Utf8ExampleController.src
FusionChartsHelper.src
XmlHelper.src
controllers
fusioncharts
fusioncharts
created.rid[33B]
README_FOR_APP[771B]
fusioncharts_helper.rb[10KB]
xml_helper.rb[1KB]
development.log[0B]
production.log[0B]
server.log[0B]
test.log[0B]
FusionCharts
FCF_Area2D.swf[19KB]
FCF_Column2D.swf[18KB]
FCF_Column3D.swf[20KB]
FCF_Line.swf[19KB]
FCF_MSColumn3D.swf[21KB]
FCF_MSColumn3DLineDY.swf[23KB]
FCF_Pie3D.swf[10KB]
FCF_StackedColumn3D.swf[21KB]
IGPLogo.jpg[7KB]
PageBg.jpg[637B]
rails.png[1KB]
Thumbs.db[9KB]
TopRightText.gif[1KB]
javascripts
stylesheets
.htaccess[1KB]
dispatch.cgi[476B]
dispatch.fcgi[858B]
dispatch.rb[476B]
favicon.ico[0B]
performance
benchmarker[117B]
profiler[114B]
request[113B]
inspector[111B]
reaper[108B]
spawner[109B]
about[96B]
console[98B]
destroy[98B]
generate[99B]
plugin[97B]
runner[97B]
server[97B]
test_helper.rb[1KB]
Rakefile[307B]
FactoryDB.mdb[172KB]
ArrayExample
BasicExample
FusionCharts.dll[7KB]
DB_dataURL
DB_DrillDown
FusionCharts
FCF_Area2D.swf[19KB]
FCF_Column2D.swf[18KB]
FCF_Column3D.swf[20KB]
FCF_Line.swf[19KB]
FCF_MSColumn3D.swf[21KB]
FCF_MSColumn3DLineDY.swf[23KB]
FCF_Pie3D.swf[10KB]
FCF_StackedColumn3D.swf[21KB]
CC_1.gif[2KB]
CC_2.gif[2KB]
CC_3.gif[7KB]
CC_4.gif[3KB]
CC_Anatomy.gif[11KB]
CC_FC.gif[8KB]
CC_Resize_Out.gif[5KB]
CC_XML_Out1.gif[15KB]
CC_XML_Out2.gif[3KB]
Col_2D.jpg[21KB]
Combi_2D.jpg[26KB]
Funnel_Basic_Anatomy.jpg[17KB]
Funnel_FirstChart.jpg[19KB]
Gantt_Anatomy.gif[23KB]
Gantt_Output.gif[21KB]
G_Funnel_1.jpg[1KB]
G_Funnel_2.jpg[2KB]
G_Funnel_3.jpg[1KB]
MS_Col2D.jpg[24KB]
XML_2DArea_1.gif[4KB]
XML_2DBar_1.gif[6KB]
XML_2DCol_1.gif[12KB]
XML_2DMSArea1.gif[15KB]
XML_2DMSBar1.gif[10KB]
XML_2DMSColumn1.gif[6KB]
XML_2DMSLine1.gif[10KB]
XML_2DPie1.gif[5KB]
XML_2DStArea.gif[15KB]
XML_2DStBar1.gif[8KB]
XML_2DStCol1.gif[6KB]
XML_3DCol_1.gif[14KB]
XML_3DMSColumn1.gif[10KB]
XML_3DPie1.gif[3KB]
XML_3DStColumn.gif[12KB]
XML_Doughnut1.gif[4KB]
XML_DY2DColLine.gif[11KB]
XML_DY3DColLine.gif[13KB]
XML_Line1.gif[10KB]
drillDown.jpg[17KB]
drillDownL.jpg[7KB]
JavaScript.jpg[19KB]
application.gif[159B]
base.gif[1KB]
cd.gif[239B]
download.gif[138B]
folder.gif[372B]
folderopen.gif[376B]
globe.gif[1KB]
imgfolder.gif[622B]
musicfolder.gif[633B]
nolines_minus.gif[861B]
nolines_plus.gif[870B]
page.gif[582B]
question.gif[1KB]
trash.gif[1KB]
AmpChar.jpg[8KB]
AposChar.jpg[9KB]
AppMessage.gif[437B]
ASPNETSettings1.jpg[9KB]
ASPNETSettings4.jpg[5KB]
ASPNETSettings5.jpg[6KB]
ASPNETSettings6.jpg[13KB]
ASPNETSettings6CS.jpg[17KB]
ASPNETSettingsCS2.jpg[24KB]
ASPNETSettingsCS3.jpg[15KB]
ASPNETSettingsVB2.jpg[23KB]
ASPNETSettingsVB3.jpg[14KB]
bgSWF.jpg[29KB]
BtnViewXML.gif[499B]
Bullet.gif[69B]
bullet_square.gif[73B]
bullet_triangle.gif[57B]
CentChar.jpg[8KB]
ChartElements1.gif[14KB]
ChartElements2.gif[8KB]
ChartElements3.gif[19KB]
ChartElements4.gif[14KB]
ChartElements5.gif[10KB]
ChartElements6.gif[5KB]
ChartElements7.gif[6KB]
ChartElements8.gif[8KB]
class_diagram_3.jpg[50KB]
ClickToActivate.jpg[68KB]
Code_Activate.jpg[36KB]
Code_ArrayMS.jpg[30KB]
Code_ArraySS.jpg[26KB]
Code_BasicChart.jpg[25KB]
Code_DB.gif[3KB]
Code_DB.jpg[28KB]
Code_DBOut.jpg[12KB]
Code_Drill.jpg[27KB]
Code_Form.gif[5KB]
Code_FormChart.jpg[12KB]
Code_JapDBChart.jpg[10KB]
Code_JapXMLFileChart.jpg[25KB]
Code_JSEx.jpg[74KB]
Code_JS_basic.jpg[18KB]
Code_JS_XML_Fin.jpg[34KB]
Code_JS_XML_Ini.jpg[12KB]
Code_RubyDB.jpg[18KB]
dataURLMethod.jpg[26KB]
dataXMLMethod.jpg[15KB]
DiscChart.jpg[15KB]
DiscChart2.jpg[11KB]
DiscChart22.jpg[17KB]
doc_head.gif[64B]
EuroChar.jpg[8KB]
FirstChart.jpg[30KB]
FolderStructure.gif[13KB]
HeaderBg.jpg[440B]
HeaderLeft.jpg[20KB]
HeaderRight.jpg[11KB]
LTGT.jpg[8KB]
multichart.jpg[21KB]
Number_1.jpg[7KB]
Number_12.jpg[9KB]
Number_13.jpg[7KB]
Number_2.jpg[7KB]
Number_3.jpg[8KB]
Number_4.jpg[8KB]
Number_5.jpg[9KB]
Number_6.jpg[9KB]
Number_7.jpg[9KB]
Number_8.jpg[10KB]
Number_9.jpg[10KB]
PercentChar.jpg[7KB]
PieChart.jpg[11KB]
PoundChar.jpg[8KB]
resize1.jpg[18KB]
screenshot_basicsimplechart.jpg[13KB]
screenshot_directorystruct.gif[3KB]
screenshot_exampleapp1.jpg[29KB]
SpChar_1.jpg[25KB]
SpChar_11.jpg[28KB]
xAxis_Rotate.jpg[9KB]
xAxis_Step.jpg[12KB]
xAxis_ToolTip.jpg[12KB]
YenChar.jpg[8KB]
_Code_Drill.jpg[26KB]
_Code_JS_XML_Fin.jpg[32KB]
PHPClassAPI
Adv_dataplot.jpg[15KB]
Adv_dataset.jpg[26KB]
Adv_trendlines1.jpg[15KB]
Adv_trendlines2.jpg[16KB]
FolderStructure.JPG[13KB]
PHPClassChangeChart.jpg[6KB]
PHPClassCombination.jpg[18KB]
PHPClassDatabaseMS.jpg[21KB]
PHPClassDatabaseSS.jpg[16KB]
PHPClassFirstChart.jpg[12KB]
PHPClassFirstChartChangeSize.jpg[15KB]
PHPClassMultiCharts.jpg[23KB]
PHPClassMultiSeries.jpg[18KB]
PHPClassStacked.jpg[16KB]
TreeImages
base.gif[641B]
cd.gif[239B]
document1.gif[129B]
email.gif[335B]
empty.gif[62B]
faq.gif[149B]
faq4.gif[137B]
folder.gif[372B]
folder2.gif[139B]
folderopen.gif[376B]
globe.gif[1KB]
help3.gif[1KB]
imgfolder.gif[622B]
join.gif[69B]
joinbottom.gif[66B]
line.gif[66B]
minus.gif[86B]
minusbottom.gif[85B]
musicfolder.gif[633B]
nolines_minus.gif[861B]
nolines_plus.gif[870B]
note3.gif[123B]
page.gif[582B]
plus.gif[89B]
plusbottom.gif[88B]
question.gif[1KB]
setup1.gif[195B]
trash.gif[1KB]
trouble.gif[146B]
CSNET.sln[1KB]
from.gif[4KB]
FusionCharts Free中文开发指南.doc[1.45MB]
最新Asp.Net源码下载.url[125B]
当前路径:FusionCharts Free V2.1/Contents/VBNET_DB.html
&?xml version=&1.0& encoding=&iso-8859-1&?&&!DOCTYPE html PUBLIC &-//W3C//DTD XHTML 1.0 Transitional//EN& &http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&&
&html xmlns=&http://www.w3.org/1999/xhtml&&
&meta http-equiv=&Content-Type& content=&text/ charset=iso-8859-1& /&
&title&FusionCharts Free Documentation&/title&
&link rel=&stylesheet& href=&Style.css& type=&text/css& /&
&table width=&98%& border=&0& cellspacing=&0& cellpadding=&3& align=&center&&
&td&&h2 class=&pageHeader&&Using FusionCharts with VB.NET (ASP.NET) & Plotting data from a database &/h2&&/td&
&td valign=&top& class=&text&&&p&In this section, we'll show you how to use FusionCharts and ASP.NET to plot charts from data contained in a database. We'll create a pie chart to show &Production by Factory& using: &/p&
&li&&span class=&codeInline&&dataXML&/span&
method first.&/li&
&li&Thereafter, we'll convert this chart to use &span class=&codeInline&&dataURL&/span&
method. &/li&
&p&For the sake of ease, we'll use an Access Database. The database is present in &span class=&codeInline&&Download Package & Code & VBNET & DB &/span&folder. You can, however, use any database with FusionCharts including MS SQL, Oracle, MySQL etc. &/p&
&p&&strong&Before you go further with this page, we recommend you to please see the previous section &&a href=&VBNET_BasicExample.html&&Basic Examples&/a&& as we start off from concepts explained in that page. &/strong&&/p&
&p class=&highlightBlock&&The code examples contained in this page are present in &span class=&codeInline&&Download Package & Code & VBNET & DBExample &/span& folder. The Access database is present in &span class=&codeInline&&Download Package & Code & VBNET &&/span& &span class=&codeInline&&DB&/span&. &/p&&/td&
&td valign=&top& class=&text&&&&/td&
&td valign=&top& class=&header&&Database Structure &/td&
&td valign=&top& class=&text&&Before we code the ASP.NET pages to retrieve data, let's quickly have a look at the database structure. &/td&
&td valign=&top& class=&text&&&img src=&Images/Code_DB.gif& /&&/td&
&td valign=&top& class=&text&&&p&The database contains just 2 tables:&/p&
&li&&span class=&codeInline&&Factory_Master&/span&: To store the name and id of each factory&/li&
&li&&span class=&codeInline&&Factory_Output&/span&: To store the number of units produced by each factory for a given date.&/li&
&p&For demonstration, we've fed some dummy data in the database. Let's now shift our attention to the ASP.NET page that will interact with the database, fetch data and then render a chart. &/p&&/td&
&td valign=&top& class=&text&&&&/td&
&td valign=&top& class=&header&&Building the ASP.NET Page for dataXML Method &/td&
&td valign=&top& class=&text&&The ASP.NET page for &span class=&codeInline&&dataXML&/span& method example is named as &span class=&codeInline&&BasicDBExample.aspx&/span& (in &span class=&codeInline&&DBExample&/span& folder). It contains the following code: &/td&
&td valign=&top& class=&text codeBlock&&&p&&%@ Page Language=&VB& AutoEventWireup=&false& CodeFile=&BasicDBExample.aspx.vb& Inherits=&DBExample_BasicDBExample& %&&/p&
&p&&HTML&&br /&
&&&HEAD&&br /&
&&&&&TITLE& FusionCharts Free - Database Example &/TITLE&&br /&
&&&&&%&br /&
&&&&&span class=&codeComment&&'You need to include the following JS file, if you intend to embed the chart using JavaScript.&/span&&br /&
&&&&%& &br /&
&&&&&strong&&SCRIPT LANGUAGE=&Javascript& SRC=&../FusionCharts/FusionCharts.js&&&/SCRIPT&&/strong&&br /&
&&&/HEAD&&/p&
&p&&&&BODY&&br /&
&&&&&strong&&asp:Literal ID=&FCLiteral& runat=&server&&&/asp:Literal&&/strong&&br /&
&&&/BODY&&br /&
&/HTML&&/p&&/td&
&td valign=&top& class=&text&&In the above code, we have included &span class=&codeInline&&FusionCharts.js&/span& file to render chart through javascript.We are also adding an ASP control literal which acts as the container for the charts. The
&span class=&codeInline&&&strong&CreateCharts()&/strong&&/span& function does the generation, and is the code behind the file, &span class=&codeInline&&BasicDBExample.vb&/span&. Let's take a look at the code behind file:
&td valign=&top& class=&codeBlock&&&p&Imports DataConnection&br /&
Imports InfoSoftGlobal&br /&
Partial Class DBExample_BasicDBExample&br /&
&&Inherits System.Web.UI.Page&/p&
&p&&&&Protected Sub &b&Page_Load&/b&(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load&/p&
&p& &span class=&codeComment&&&&&&&&' Generate chart in Literal Control&/span&&br /&
&b&&&&&&&FCLiteral.Text = CreateChart()&/b&&br /&
&&&End Sub&/p&
&p& &&&Public Function CreateChart() As String&br /&
&&&&span class=&codeComment&&&&&'In this example, we show how to connect FusionCharts to a database.&br /&
&&&&&&'For the sake of ease, we've used an Access database which is present in&br /&
&&&&&&'../App_Data/FactoryDB.mdb. It just contains two tables, which are linked to each&br /&
&&&&&&'other. &/span&&/p&
&p class=&codeComment&& &&&&&&'Database Objects - Initialization&br /&
&&&&&&Dim oRs As DbConn, strQuery As String&br /&
&&&&&&'strXML will be used to store the entire XML document generated&br /&
&&&&&&Dim strXML As String&/p&
&p& &&&&&&&span class=&codeComment&&'Generate the graph element&/span&&br /&
&&&&&&strXML = &&graph caption='Factory Output report' subCaption='By Quantity' decimalPrecision='0' showNames='1'
numberSuffix=' Units'
pieSliceDepth='30' formatNumberScale='0'&&&/p&
&p& &span class=&codeComment&&&&&&&&' SQL Query&/span&&br /&
&&&&&&strQuery = &select a.FactoryId,a.FactoryName, sum(b.Quantity) as TotOutput from factory_master a,factory_output b where a.FactoryId=b.FactoryId group by a.FactoryId,a.FactoryName&&/p&
&p& &&&&&&span class=&codeComment&&&' Open Data Reader&/span&&br /&
&&&&&&oRs = New DbConn(strQuery)&br /&
&&&&&&&span class=&codeComment&&'Iterate through each factory&/span&&br /&
&&&&&&While oRs.ReadData.Read()&/p&
&p& &&&&&&span class=&codeComment&&&'Generate &set name='..' value='..' /& &/span&&br /&
&&&&&&strXML = strXML & &&set name='& & oRs.ReadData(&FactoryName&).ToString() & &' value='& & oRs.ReadData(&TotOutput&).ToString() & &' /&&&br /&
&&&End While&/p&
&p& &&&&&&span class=&codeComment&&&' Close Data Reader&/span&&br /&
&&&&&&oRs.ReadData.Close()&br /&
&&&&&&span class=&codeComment&&&'Finally, close &graph& element&/span&&br /&
&&&&&&strXML = strXML & &&/graph&&&/p&
&p& &span class=&codeComment&&&&&&&&'Create the chart - Pie 3D Chart with data from strXML&/span&&br /&
&&&&&&b&&Return FusionCharts.RenderChart(&../FusionCharts/FCF_Pie3D.swf&, &&, strXML, &FactorySum&, &650&, &450&, False, False)&/b&&/p&
&p& &&&End Function&/p&
&p&End Class&br /&
&td valign=&top& class=&text&&&p&The following actions are taking place in this code:&/p&
&li&We first include &span class=&codeInline&&DataConnection&/span&
and &span class=&codeInline&&InfoSoftGlobal&/span& namespace. &span class=&codeInline&&&a href=&#DataConn&&DataConnection&/a&&/span& namespace is contained within &span class=&codeInline&&DataConn&/span& VB.NET class inside &span class=&codeInline&&App_Code&/span& folder of Download pack. It contains the connection parameters to connect to Access database. And &span class=&codeInline&&InfoSoftGlobal&/span& namespace is from &span class=&codeInline&&FusionCharts.dll&/span& file in &span class=&codeInline&&bin&/span& directory. &/li&
&li&We declare variables &span class=&codeInline&&strQuery&/span& to store SQL query that fetches data from database and &span class=&codeInline&&strXML&/span& to store XML data.&/li&
&li&Thereafter, we generate the XML data document by iterating through the recordset and store it in &span class=&codeInline&&strXML&/span& variable. &/li&
&li&Finally, we render the chart using &span class=&codeInline&&RenderChart()&/span& method and pass &span class=&codeInline&&strXML&/span& as &span class=&codeInline&&dataXML&/span&.
&span class=&codeInline&&RenderChart()is called form the Page_Load&/span&&span class=&codeInline&& event listener&/span&.&/li&
&p&When you now run the code, you'll get an output as under: &/p&&/td&
&td valign=&top& class=&text&&&img src=&Images/Code_DBOut.jpg& class=&imageBorder& /&&/td&
&td valign=&top& class=&text&&&&/td&
&td valign=&top& class=&header&&Converting the example to use dataURL method &/td&
&td valign=&top& class=&text&&&p&Let's now convert this example to use dataURL method. As previously explained, in dataURL mode, you need two pages:&/p&
&li&&strong&Chart Container Page&/strong& - The page which embeds the HTML code to render the chart. This page also tells the chart where to load the data from. We'll name this page as &span class=&codeInline&&Default.aspx&/span&. &/li&
&li&&strong&Data Provider Page&/strong& - This page provides the XML data to the chart. We'll name this page as &span class=&codeInline&&PieData.aspx&/span&.&/li&
&p class=&highlightBlock&&The pages in this example are contained in&span class=&codeInline&& Download Package & Code & CNET & DB_dataURL&/span& folder. &/p&
&td valign=&top& class=&text&&&&/td&
&td valign=&top& class=&header&&Chart Container Page - &span class=&codeInline&&Default.aspx &/span&&/td&
&td valign=&top& class=&text&&&span class=&codeInline&&Default.aspx&/span& contains the following code to render the chart: &/td&
&td valign=&top& class=&codeBlock&&&p&&%@ Page Language=&VB& %&&br /&
&%@ Import Namespace=&InfoSoftGlobal& %&&br /&
&script runat=&server&&&/p&
&p& &&&Protected Sub &b&Page_Load&/b&(ByVal sender As Object, ByVal e As System.EventArgs)&br /&
&&&&&&&span class=&codeComment&&'In this example, we show how to connect FusionCharts to a database &br /&
&&&&&&'using dataURL method. In our other examples, we've used dataXML method&br /&
&&&&&&'where the XML is generated in the same page as chart. Here, the XML data&br /&
&&&&&&'for the chart would be generated in PieData.aspx.&br /&
&&&&&&'For the sake of ease, we've used an Access database which is present in&br /&
&&&&&&'../App_Data/FactoryDB.mdb. It just contains two tables, which are linked to each&br /&
&&&&&&'other.&br /&
&&&&&&'Variable to contain dataURL&/span&&br /&
&&&&&&Dim strDataURL as string &br /&
&&&&&&span class=&codeComment&&&'the ASP.NET script in piedata.aspx interacts with the database, &br /&
&&&&&&'converts the data into proper XML form and finally &br /&
&&&&&&'relays XML data document to the chart&/span&&br /&
&&&&&&&strong&strDataURL = &PieData.aspx&&/strong&&br /&
&&&&&&&span class=&codeComment&&'Create the chart - Pie 3D Chart with dataURL as strDataURL&/span&&br /&
&&&&&&&&b&FCLiteral.Text = FusionCharts.RenderChart(&../FusionCharts/FCF_Pie3D.swf&, strDataURL, &&, &FactorySum&, &650&, &450&, False, False)&/b&&br /&
&&&End Sub&/p&
&p& &/script&&/p&
&p&&HTML&&br /&
&&&HEAD&&br /&
&&&&&TITLE&&br /&
&&&&&&FusionCharts Free - dataURL and Database
Example&br /&
&&&&&/TITLE&&br /&
&&&&&%&br /&
&&&&&&&span class=&codeComment&&'You need to include the following JS file, if you intend to embed the chart using JavaScript.&/span&&br /&
&&&&%& &br /&
&&&&&strong&&SCRIPT LANGUAGE=&Javascript& SRC=&../FusionCharts/FusionCharts.js&&&/SCRIPT&&/strong&&br /&
&&&/HEAD&&br /&
&&&BODY&&/p&
&p& &&&&b&&asp:Literal ID=&FCLiteral& runat=&server&&&/asp:Literal& &&&/b&&br /&
&&&/BODY&&br /&
&/HTML&&/p&
&td valign=&top& class=&text&&&p&In the above code, we:s&/p&
&li&Include &span class=&codeInline&&InfoSoftGlobal&/span& namespace and &span class=&codeInline&&FusionCharts.js&/span& JavaScript class.&span class=&codeInline&&&/span&&/li&
&li&Create the &span class=&codeInline&&dataURL&/span& string and store it in &span class=&codeInline&&strDataURL&/span& variable. &/li&
&li&Finally, we render the chart using &span class=&codeInline&&RenderChart()&/span& method and set &span class=&codeInline&&dataURL&/span& as &span class=&codeInline&&strDataURL&/span&. &/li&
&td valign=&top& class=&header&&Creating the data provider page &span class=&codeInline&&PieData.aspx.vb &/span&&/td&
&td valign=&top& class=&text&&&span class=&codeInline&&PieData.aspx.vb&/span& contains the following code to output XML Data:
&td valign=&top& class=&codeBlock&&&p&Imports DataConnection&br /&
Partial Class DB_dataURL_PieData&br /&
Inherits System.Web.UI.Page&/p&
Protected Sub &b&Page_Load&/b&(ByVal obj As Object, ByVal e As EventArgs) Handles Me.Load&br /&
&span class=&codeComment&&&&&&&&'This page generates the XML data for the Pie Chart contained in&br /&
&&&&&&'Default.aspx. &/span&&/p&
&p& &span class=&codeComment&&&&&&&&'For the sake of ease, we've used an Access database which is present in&br /&
&&&&&&'../App_Data/FactoryDB.mdb. It just contains two tables, which are linked to each&br /&
&&&&&&'other. &/span&&/p&
&p& &span class=&codeComment&&&&&&&&'Database Objects - Initialization&/span&&br /&
&span class=&codeComment&&&&&&&&&/span&Dim oRs As DbConn, strQuery As String&br /&
&span class=&codeComment&&&&&&&&'strXML will be used to store the entire XML document generated&/span&&br /&
&span class=&codeComment&&&&&&&&&/span&Dim strXML As String&/p&
&p& &span class=&codeComment&&&&&&&&'Generate the graph element&/span&&br /&
&span class=&codeComment&&&&&&&&&/span&strXML = &&graph caption='Factory Output report' subCaption='By Quantity' decimalPrecision='0' showNames='1' numberSuffix=' Units' pieSliceDepth='30' formatNumberScale='0'&&&/p&
&p& &span class=&codeComment&&&&&&&&' SQL Query&/span&&br /&
&span class=&codeComment&&&&&&&&&/span&strQuery = &select a.FactoryId,a.FactoryName, sum(b.Quantity) as TotOutput from factory_master a,factory_output b where a.FactoryId=b.FactoryId group by a.FactoryId,a.FactoryName&&/p&
&p& &span class=&codeComment&&&&&&&&' Open Data Reader&/span&&br /&
&span class=&codeComment&&&&&&&&&/span&oRs = New DbConn(strQuery)&/p&
&p& &span class=&codeComment&&&&&&&&'Iterate through each factory&/span&&br /&
&span class=&codeComment&&&&&&&&&/span&While oRs.ReadData.Read()&br /&
&span class=&codeComment&&&&&&&&&&&'Generate &set name='..' value='..'/& &/span&&br /&
&span class=&codeComment&&&&&&&&&&&&/span&strXML = strXML & &&set name='& & oRs.ReadData(&FactoryName&).ToString() & &' value='& &span class=&codeComment&&&&&&&&&/span&& oRs.ReadData(&TotOutput&).ToString() & &' /&&&/p&
&p& &span class=&codeComment&&&&&&&&&/span&End While&br /&
&span class=&codeComment&&&&&&&&' Close Data Reader&/span&&br /&
&span class=&codeComment&&&&&&&&&/span&oRs.ReadData.Close()&br /&
&span class=&codeComment&&&&&&&&'Finally, close &graph& element&/span&&br /&
&span class=&codeComment&&&&&&&&&/span&strXML = strXML & &&/graph&&&/p&
&p& &span class=&codeComment&&&&&&&&'Set Proper output content-type&/span&&br /&
&span class=&codeComment&&&&&&&&&/span&&b&Response.ContentType = &text/xml&&/b&&/p&
&p& &span class=&codeComment&&&&&&&&'Just write out the XML data&br /&
&&&&&&'NOTE THAT THIS PAGE DOESN'T CONTAIN ANY HTML TAG, WHATSOEVER&/span&&br /&
&span class=&codeComment&&&&&&&&&/span&&b&Response.Write(strXML)&/b&&br /&
&&&End Sub&br /&
&td valign=&top& class=&text&&&p&In the above page:&/p&
&li&Include &a href=&#DataConn&&DataConnection Namespace&/a& to fetch data from database. &/li&
&li&The result is stored it in &span class=&codeInline&&strXML&/span& variable.&/li&
&li&Finally, we write this data to output stream without any HTML tags. &/li&
&p&When you view this page, you'll get the same output as before. &/p&&/td&
&td valign=&top& class=&text&&&&/td&
&td class=&text& valign=&top&&&a name=&DataConn& class=&header& id=&DataConn&&Inside DataConnection Namespace&/a& &/td&
&td class=&text& valign=&top&&We have used DataConnection Namespace in the above
code and in all subsequent Database examples. Using this class we establish connection to
Access database with ADO.NET component. Let's go through the lines of code
inside this class: &/td&
&td class=&text& valign=&top&&&&/td&
&td class=&codeBlock& valign=&top&&&p&Imports Microsoft.VisualBasic&br&
Imports System.Data.Odbc&br&
Imports System.Data&br&
Imports System.Web&br&
Imports System.Configuration&/p&
&p&Namespace DataConnection&/p&
&p& &span class=&codeComment&&&& ''' &summary&&br&
&& ''' DataBase Connection Class.&br&
&& ''' &/summary&&/span&&br&
&& Public Class DbConn&br&
&& && Public connection As OdbcConnection&br&
&& && Public ReadData As OdbcDataReader&br&
&& && Public aCommand As OdbcCommand&/p&
&p& &span class=&codeComment&&&& && ''' &summary&&br&
&& && ''' Data Connection and get Data Reader&br&
&& && ''' &/summary&&br&
&& && ''' &param name=&strQuery&&SQL Query&/param&&/span&&br&
&& && Public Sub New(ByVal strQuery As String)&br&
&& && && Dim ConnectionString As String, connectionName As String&/p&
&p& && && && &span class=&codeComment&&' MS Access DataBase Connection - Defined in Web.Config&/span&&br&
&& && && connectionName = &MSAccessConnection&&/p&
&p& && && && &span class=&codeComment&&'' SQL Server DataBase Connection - Defined in Web.Config&br&
&& && && '' connectionName = &SQLServerConnection&;&/span&&/p&
&p& && && && &span class=&codeComment&&' Creating Connection string using web.config connection string&/span&&br&
&& && && ConnectionString = ConfigurationManager.ConnectionStrings(connectionName).ConnectionString&br&
&& && && Try&/p&
&p& && && && && &span class=&codeComment&&' Creating OdbcConnection Oject&/span&&br&
&& && && && connection = New OdbcConnection()&/p&
&p& && && && && &span class=&codeComment&&' Setting Conection String&/span&&br&
&& && && && connection.ConnectionString = ConnectionString&/p&
&p& && && && && &span class=&codeComment&&' Open Connection&/span&&br&
&& && && && connection.Open()&/p&
&p& && && && && &span class=&codeComment&&' get reader&/span&&br&
&& && && && GetReader(strQuery)&/p&
&p& && && && && Catch ex As Exception&br&
&& && && && HttpContext.Current.Response.Write(ex.Message)&br&
&& && && End Try&/p&
&p& && && End Sub&br&
&span class=&codeComment&&&br&
&& && ''' &summary&&br&
&& && ''' Create an instance dataReader&br&
&& && ''' &/summary&&br&
&& && ''' &param name=&strQuery&&SQL Query&/param&&br&
&& && ''' &remarks&Return type object of OdbcDataReader&/remarks&&/span&&br&
&& && Public Sub GetReader(ByVal strQuery As String)&/p&
&p& && && && &span class=&codeComment&&'
Create a Command object&/span&&br&
&& && && aCommand = New OdbcCommand(strQuery, connection)&/p&
&p& && && && &span class=&codeComment&&' Create data reader object using strQuery string&/span&&br&
&& && && ReadData = aCommand.ExecuteReader(CommandBehavior.CloseConnection)&/p&
&p& && &&End Sub&br&
&& End Class&br&
End Namespace&/p&
&p&&/p&&/td&
&td class=&text& valign=&top&&&&/td&
&td class=&text& valign=&top&&What it does:&br&
&li&Set up Connection as per the connection string defined in &span class=&codeInline&&web.config&/span& file.&br&
&span class=&codeInline&&&connectionStrings&&br&
&&& &add name=&MSAccessConnection& providerName=&System.Data.Odbc& connectionString=&Driver={Microsoft Access Driver (*.mdb)};Dbq=|DataDirectory|\FactoryDB.mdb&/&&br&
&/connectionStrings&&/span&&br&
To change your connection to any other database server, you only need to setup
&span class=&codeInline&&web.config&/span& file. &br&
&li&The code to connect to SQL Server Database is also given in comment form. To
connect to SQL Server you have to activate the corresponding code. &br&
&li&It accepts SQL Query, executes it and returns the result as ASP.NET &span class=&codeInline&&DataReader&/span& object -&span class=&codeInline&&ReadData&/span&&span class=&text&&. &/span& &/li&
&/ul&&/td&
&td class=&text& valign=&top&&&&/td&

我要回帖

更多关于 dbdatareader 的文章

 

随机推荐