1
private
static
void
writexml(
string
strfilename,
string
code, datetime from,datetime to)27
//將locationid讀到陣列中
8string
select=""
;9
select="
select locationid from master_goodsbylocation where goodscode='"+
code+"
'order by locationid";
10oledbdataadapter m_dal
=new
oledbdataadapter(select,m_dc);
11dataset m_dsl
=new
dataset();
12m_dal.fill(m_dsl,
"master_goodsbylocation");
13datatable tl
=m_dsl.tables[
"master_goodsbylocation"];
14string
locationid1
=new
string
[tl.rows.count];
15inti=
0;
16foreach
(datarow rl
intl.rows)
1721
m_dsl.reset();
22system.xml.xmltextwriter w
=new
xmltextwriter(strfilename, system.text.encoding.utf8);
23w.formatting
=formatting.indented;
2425
w.writestartdocument(
true
);26
//start rood element
2728
w.writestartelement(
"data");
29w.writeattributestring(
"type",
"checkdata");
30w.writeattributestring(
"goodscode
",code);
31w.writeattributestring(
"startdate
", from.tostring(
"yyyy-mm-dd
"));
32w.writeattributestring(
"enddate
", to.tostring(
"yyyy-mm-dd
"));
3334
//start location
35foreach
(string
location
inlocationid1)
3653
reader.close();
54w.writewhitespace(""
);55
w.writeendelement();
5657
//node "realsale"
58w.writestartelement(
"realsale");
59oc
=new
oledbcommand(
"select date,realsale from temp_realsale where goodscode='"+
code+"
'and locationid='"+
location+"
'and date<=#"+
to+
"#and date>=#"+
from+"
#order by date
",m_dc);
60reader
=oc.executereader();
61while
(reader.read())
6269
reader.close();
70w.writewhitespace(""
);71
w.writeendelement();
7273
//node "abnormity"
74w.writestartelement(
"abnormity");
75oc
=new
oledbcommand(
"select date,abnormity from temp_abnormity where goodscode='"+
code+"
'and locationid='"+
location+"
'and date<=#"+
to+
"#and date>=#"+
from+"
#order by date
",m_dc);
76reader
=oc.executereader();
77while
(reader.read())
7885
reader.close();
86w.writewhitespace(""
);87
w.writeendelement();
8889
//node "statbymonth"
90w.writestartelement(
"statbymonth");
91oc
=new
oledbcommand(
"select startdate,realstock,stockouttimes,safetystock,safetystocktime from temp_statbymonth where goodscode='"+
code+"
'and locationid='"+
location+"
'and startdate<=#"+
to+
"#and startdate>#"+
from.addmonths(-1
)+
"#order by startdate
",m_dc);
92reader
=oc.executereader();
93while
(reader.read())
94104
reader.close();
105w.writewhitespace(""
);106
w.writeendelement();
107108
//end location
109w.writewhitespace(""
);110
w.writeendelement();
111}
112//
end root element
113w.writewhitespace(
"/r/n");
114w.writeendelement();
115116
//w.writeendelement();
117w.flush();
118w.close();
119//
return true;
120}
如何從資料庫中讀取資料
今天要用資料庫的時候,我發現我竟然忘記了怎麼從資料庫中讀取資料,而查了一圈谷歌,又是非常失望 內容基本就是摘抄了mysqldb和web.py的官方文件,實在是失望。這篇文章先介紹mysqldb和web.py,django以後補上。db mysqldb.connect cursor db.cursor...
從ACCESS資料庫中讀取Images
response.contenttype image 表示顯示所有支援的型別型別 如下,假設資料庫為image.mdb set conngraph server.createobject adodb.connection conngraph.connectionstring provider mic...
PHP 從資料庫中取出資料並存為Json資料
include conn.php sql select from user sql result mysql query sql 執行sql json data array 定義好一個陣列.php中array相當於一個資料字典.定義一個類,用到存放從資料庫中取出的資料.class user whil...
使用redis快取從資料庫中讀取資料
使用redis從資料庫中讀取資料後快取 class myredis return self handler public static function get key return value public static function set key,value return self han...
從資料庫中取出的列表資料進行分頁功能如何實現?
建立出你需要的屬性比如在我的專案中我需要用到的 有當前的頁碼currentpage 當前的頁顯示的數量currentcount 你從資料庫中查詢得到的所有資料總和totalcount 這個你需要在dao層定義方法實現並把得到的資料返回給service層 一共需要分多少頁totalpage 這個需要你...