Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,038

HOME > .NET Framework > Forum > Crystal Report แสดงรายงานโดย เลือกวันที่...ถึงวันที่.... มันต้องใช้ Class อะไรบ้าง


 

[.NET] Crystal Report แสดงรายงานโดย เลือกวันที่...ถึงวันที่.... มันต้องใช้ Class อะไรบ้าง

 
Topic : 047780



โพสกระทู้ ( 66 )
บทความ ( 0 )



สถานะออฟไลน์



ถ้าจะกำหนดใส่ พารามิเตอร์สัก 2อัน มันทำได้ไหม งงไปหมดแล้วอ่ะ ทำได้แต่แสดง เป็น เดือน กว่าจะทำได้ นี่ยังต้อง แสดงแบบเลือกวันที่อีก เหนื่อยใจ มาก ครับ ช่วยหน่อยครับ





อันนี้ตัวอย่างแสดง เดือนนั้นๆ
Code (C#)
01.public void GetData(string str)
02.       {
03.        textBox1.Text = str;
04.       }
05. 
06.       private void FormReport6_Load(object sender, EventArgs e)
07.       {
08.           
09.           ReportDocument cryRpt = new ReportDocument();
10.           cryRpt.Load("E:\\งาน\\Pro\\pro\\systemdata M\\systemdata\\CrystalReport7.rpt");
11. 
12.           ParameterFieldDefinitions crParameterFieldDefinitions;
13.           ParameterFieldDefinition crParameterFieldDefinition;
14.           ParameterValues crParameterValues = new ParameterValues();
15.           ParameterDiscreteValue crParameterDiscreteValue = new ParameterDiscreteValue();
16. 
17.           crParameterDiscreteValue.Value = textBox1.Text;
18.           crParameterFieldDefinitions = cryRpt.DataDefinition.ParameterFields;
19.           crParameterFieldDefinition = crParameterFieldDefinitions["scb"];
20.           crParameterValues = crParameterFieldDefinition.CurrentValues;
21. 
22.           crParameterValues.Clear();
23.           crParameterValues.Add(crParameterDiscreteValue);
24.           crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);
25.                  
26.           crystalReportViewer1.ReportSource = cryRpt;
27.           crystalReportViewer1.Refresh();
28.            
29.            
30.       }


รายงาน



Tag : .NET, MySQL, Crystal Report, Win (Windows App), C#

Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2010-08-27 16:39:54 By : thaic View : 2827 Reply : 1
 

 

No. 1



โพสกระทู้ ( 66 )
บทความ ( 0 )



สถานะออฟไลน์


เออ มั่วเองจนได้ ครับ " ถามเองตอบเอง T_T "

Code (C#)
001.public void GetData(string str)
002.            {
003.                //ข้อมูลส่งมาจาก อีก ฟอรม
004.             textBox1.Text = str;  
005.            }
006. 
007.            private void FormReport6_Load(object sender, EventArgs e)
008.            {
009.                                                                     
010.            string[] pb = textBox1.Text.Split((" ").ToCharArray());
011.            textBox2.Text = pb[0];
012.            textBox3.Text = pb[1];
013.            textBox10.Text = textBox2.Text + "-" + textBox3.Text;
014.               
015.            CrystalDecisions.Shared.ParameterFields pfields = new CrystalDecisions.Shared.ParameterFields();    
016.            CrystalDecisions.Shared.ParameterField pfield = new CrystalDecisions.Shared.ParameterField();           
017.            CrystalDecisions.Shared.ParameterDiscreteValue disvalue = new   CrystalDecisions.Shared.ParameterDiscreteValue();
018. 
019.                string[] pp = textBox10.Text.Split(("-").ToCharArray());
020.                string dayer = pp[2];
021.                string MonthPart = pp[1];
022.                string pre = pp[0];
023.                string day2 = pp[5];
024.                string mon = pp[4],mmo="";
025.                string pre2 = pp[3],mont="";
026. 
027.                if (MonthPart == "1")
028.                {
029.                    mont = "มกราคม";
030.                }
031.                else if (MonthPart == "2")
032.                {
033.                    mont = "กุมภาพันธ์";
034.                }
035.                else if (MonthPart == "3")
036.                {
037.                    mont = "มีนาคม";
038.                }
039.                else if (MonthPart == "4")
040.                {
041.                    mont = "เมษายน";
042.                }
043.                else if (MonthPart == "5")
044.                {
045.                    mont = "พฤษภาคม";
046.                }
047.                else if (MonthPart == "6")
048.                {
049.                    mont = "มิถุนายน";
050.                }
051.                else if (MonthPart == "7")
052.                {
053.                    mont = "กรกฎาคม";
054.                }
055.                else if (MonthPart == "8")
056.                {
057.                    mont = "สิงหาคม";
058.                }
059.                else if (MonthPart == "9")
060.                {
061.                    mont = "กันยายน";
062.                }
063.                else if (MonthPart == "10")
064.                {
065. 
066.                    mont = "ตุลาคม";
067.                }
068.                else if (MonthPart == "11")
069.                {
070.                    mont = "พฤศจิกายน";
071.                }
072.                else if (MonthPart == "12")
073.                {
074.                    mont = "ธันวาคม";
075.                }
076.                else
077.                {
078. 
079.                }
080. 
081. 
082.                if (mon == "1")
083.                {
084.                    mmo = "มกราคม";
085.                }
086.                else if (mon == "2")
087.                {
088.                    mmo = "กุมภาพันธ์";
089.                }
090.                else if (mon == "3")
091.                {
092.                    mmo = "มีนาคม";
093.                }
094.                else if (mon == "4")
095.                {
096.                    mmo = "เมษายน";
097.                }
098.                else if (mon == "5")
099.                {
100.                    mmo = "พฤษภาคม";
101.                }
102.                else if (mon == "6")
103.                {
104.                    mmo = "มิถุนายน";
105.                }
106.                else if (mon == "7")
107.                {
108.                    mmo = "กรกฎาคม";
109.                }
110.                else if (mon == "8")
111.                {
112.                    mmo = "สิงหาคม";
113.                }
114.                else if (mon == "9")
115.                {
116.                    mmo = "กันยายน";
117.                }
118.                else if (mon == "10")
119.                {
120. 
121.                    mmo = "ตุลาคม";
122.                }
123.                else if (MonthPart == "11")
124.                {
125.                    mmo = "พฤศจิกายน";
126.                }
127.                else if (MonthPart == "12")
128.                {
129.                    mmo = "ธันวาคม";
130.                }
131.                else
132.                {
133. 
134.                }
135. 
136. 
137.                 
138.                textBox11.Text = dayer +" "+ mont +" "+ pre;
139.                textBox4.Text = day2 + " " + mmo + " " + pre2;
140. 
141. 
142.            SqlConnection cnn;
143.            string connectionString = null;
144.            string sql = null;
145. 
146.            connectionString = "Data Source =.\\SqlExpress;Initial Catalog=datatest;Integrated Security=true";
147.            cnn = new SqlConnection(connectionString);
148.            cnn.Open();
149.            sql = "SELECT*FROM datapeople where daterecord between '" + textBox2.Text + "' and '" + textBox3.Text + "'";
150.            SqlDataAdapter dscmd = new SqlDataAdapter(sql, cnn);
151.            DataSet ds = new DataSet();
152.            dscmd.Fill(ds, "PC");
153.          
154.            cnn.Close();
155. 
156.            CrystalReport7 objRpt = new CrystalReport7();
157.            objRpt.SetDataSource(ds.Tables["PC"]);
158. 
159.            disvalue.Value = textBox11.Text+"                      "+textBox4.Text;           
160.            pfield.Name = "dte";       
161.            pfield.CurrentValues.Add(disvalue);           
162.            pfields.Add(pfield);
163.            crystalReportViewer1.ParameterFieldInfo = pfields; 
164.                   
165.            crystalReportViewer1.ReportSource = objRpt;
166.            crystalReportViewer1.Refresh();
167.       
168.             
169.        }


เผื่อใครมีปัญหาคล้ายๆ ผม สูตรนี้เป็นแบบผสมผสาน ไมรู้มันทำได้ไง ^ ^


ประวัติการแก้ไข
2010-08-29 17:58:19
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2010-08-29 17:57:37 By : thaic
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : Crystal Report แสดงรายงานโดย เลือกวันที่...ถึงวันที่.... มันต้องใช้ Class อะไรบ้าง
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)





ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2025 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่