วันอาทิตย์ที่ 24 เมษายน พ.ศ. 2554
วันจันทร์ที่ 18 เมษายน พ.ศ. 2554
Free Button Control 6 Styles 5 Themes
AsButton เป็นคอนโทรลประเภทปุ่มกดที่อยู่ในชุด StoneUI สามารถใช้ได้ฟรี
![]() |
กำหนดลักษณะการทำงานได้ 6 แบบคือ
- Push Button เป็นปุ่มกดปกติ
- Color Picker เป็นปุ่มกดแล้วเลือกสีได้
- Toggle Button เป็นปุ่มกดแล้วสลับไปมาระหว่างสถานะ กด/ปกติ (เหมือน checkbox)
- Toggle Button for iPhone style เป็นปุ่มกดหรือสไลด์ไปมาระหว่างสถานะ On/Off
- Dropdown Button เป็นปุ่มกดแล้วมีเมนูให้เลือก
- Split Button เป็นปุ่มกดปกติและมีเมนูให้เลือกด้วย
มีรูปแบบให้เลือกได้ 5 แบบ
- System3D (supported visual style)
- OfficeXP
- Office2003
- AeroGlass
- Office2007
Download: https://sites.google.com/site/noteacode/files/StoneUI_Pro_Net2_WinForms.zip?attredirects=0&d=1
วันเสาร์ที่ 9 เมษายน พ.ศ. 2554
ต้องการ Tester สำหรับ StoneUI Grid and DataEditors for .Net WinForms
StoneUI Grid and DataEditors for .Net WinForms เป็น Components สำหรับ Visual Studio 2005(.Net2) ขึ้นไป
ต้องการอาสาสมัคร(100 ท่าน) ทดสอบ Components ชุดนี้ ซึ่งคุณจะได้รับ license ฟรี 1 ชุด โดยมีเงื่อนไข 3 ข้อครับ
1. comment หรือแจ้ง bug ที่ท่านพบ
2. capture หน้าจอ project ของท่านที่ใช้กับ components ชุดนี้(ขอ 3 รูปขึ้นไป) + คำอธิบายย่อ ๆ เกี่ยวกับ project
3. ชื่อ-นามสกุล และชื่อที่ทำงาน(ถ้ามี)
Download ได้ที่ https://sites.google.com/site/noteacode/files/
ต้องการอาสาสมัคร(100 ท่าน) ทดสอบ Components ชุดนี้ ซึ่งคุณจะได้รับ license ฟรี 1 ชุด โดยมีเงื่อนไข 3 ข้อครับ
1. comment หรือแจ้ง bug ที่ท่านพบ
2. capture หน้าจอ project ของท่านที่ใช้กับ components ชุดนี้(ขอ 3 รูปขึ้นไป) + คำอธิบายย่อ ๆ เกี่ยวกับ project
3. ชื่อ-นามสกุล และชื่อที่ทำงาน(ถ้ามี)
Download ได้ที่ https://sites.google.com/site/noteacode/files/
ป้ายกำกับ:
StoneUI
วันศุกร์ที่ 1 เมษายน พ.ศ. 2554
อะไรคือ WPF แล้ว Silverlight ล่ะ
WPF(Windows Presentation Foundation) เป็นเทคโนโลยีใหม่ของ ms ที่สร้างขึ้นมาเพื่อเป็นอนาคตของ Applcation บน Windows(และ run บน windows เท่านั้น) ที่สามารถสร้างสรรค์ Application ในแบบ rich ui, supported render 3d แม้กระทั่งใช้ความสามารถของ directX และความสามารถใหม่ ๆ หลายอย่างที่เพิ่มขึ้นจากเทคโนโลยี WinForms แต่ด้วยว่า WPF เป็นเทคโนโลยีที่สร้างขึ้นใหม่ มันจึงยังต้องการการพัฒนา ให้มีความสามารถเหนือกว่า WinForms ในทุก ๆ ด้าน เช่น แม้ WPF จะ render 3d โดยใช้ direcxtX ได้ คือใช้ความสามารถของการ์ดจอได้โดยตรง แต่ทำไมรู้สึกว่ามันทำงานได้ช้ากว่า WinForms ก็ไม่รู้เหมือนกัน
ส่วน Silverlight นั้นเป็น subset ของ WPF อีกที ที่ต้องการให้มันสามารถรันข้ามแพลตฟอร์มได้ในทุก ๆ browser จบ.
ส่วน Silverlight นั้นเป็น subset ของ WPF อีกที ที่ต้องการให้มันสามารถรันข้ามแพลตฟอร์มได้ในทุก ๆ browser จบ.
ป้ายกำกับ:
silverlight,
wpf
วันจันทร์ที่ 27 ธันวาคม พ.ศ. 2553
คำศัพท์คอมพิวเตอร์ แปลไทย
ระเบียน (Record, Row) = โครงสร้างข้อมูลที่แทนตัววัตถุชิ้นหนึ่ง
สดมภ์ (Column) = ช่องในแนวตั้ง
เส้นพิกัด (Grid) = เส้นบอกตำแหน่ง
เข้าใช้ระบบ (Log in) = การตรวจสอบตัวตนก่อนเข้าใช้งาน
ส่วนติดต่อผู้ใช้ (User Interface) = เช่นปุ่มกด คอมโบ เรดิโอบ๊อกซ์
รูปลักษณ์ (Appearance) = ลักษณะ รูปทรงที่มองเห็นได้
บริบท (Behavior) = พฤติกรรม ท่าทาง อาการ
สดมภ์ (Column) = ช่องในแนวตั้ง
เส้นพิกัด (Grid) = เส้นบอกตำแหน่ง
เข้าใช้ระบบ (Log in) = การตรวจสอบตัวตนก่อนเข้าใช้งาน
ส่วนติดต่อผู้ใช้ (User Interface) = เช่นปุ่มกด คอมโบ เรดิโอบ๊อกซ์
รูปลักษณ์ (Appearance) = ลักษณะ รูปทรงที่มองเห็นได้
บริบท (Behavior) = พฤติกรรม ท่าทาง อาการ
วันศุกร์ที่ 12 พฤศจิกายน พ.ศ. 2553
ลบอักขระเว้นวรรคหลาย ๆ ตัวที่อยู่ติดกันให้เหลือเว้นวรรคเดียว/Trim all white space in string to single
อักษรเว้นวรรค(space bar/white space) ที่อยู่ติดกันหลาย ๆ ตัวที่บางที user คีย์เข้ามาใส่ในโปรแกรมหรือฐานข้อมูล พอจะเอามาแสดงผลมันจะกลายเป็นช่องว่างไม่สวยงาม ซึ่งหลาย ๆ คนคงคิดถึงเจ้าฟังก์ชั่นที่ชื่อ Trim แต่ฟังก์ชั่นนี้สามารถตัดอักขระที่อยู่ด้านหน้าและด้านหลังของข้อความเท่านั้น ส่วนอักขระเว้นวรรคที่อยู่ตรงกลางข้อความจะไม่มีผลอะไร ซึ่งหากเราหันไปใช้ฟังก์ชั่่น Remove หรือ Replace ก็อาจจะไม่สะดวกเพราะไม่ทราบจำนวนอักขระเว้นวรรคที่แน่นอนได้
แต่ยังมี class ที่น่าสนใจอีกตัวหนึ่งคือ RegEx ที่มีฟังก์ชั่น Replace ที่แก้ปัญหานี้ได้ มีรูปแบบการใช้งานคือ
c#
vb
เพียงเท่านี้ชีวิตเราก็จะง่ายขึ้นไปอีกนิดนึงแล้ว
แต่ยังมี class ที่น่าสนใจอีกตัวหนึ่งคือ RegEx ที่มีฟังก์ชั่น Replace ที่แก้ปัญหานี้ได้ มีรูปแบบการใช้งานคือ
c#
public static string TrimSpace(string text)
{
return Regex.Replace(text, @"\s+", " ");
}
vb
Public Shared Function TrimSpace(ByVal text As String) As String
Return Regex.Replace(text, "\s+", " ")
End Function
เพียงเท่านี้ชีวิตเราก็จะง่ายขึ้นไปอีกนิดนึงแล้ว
วันศุกร์ที่ 6 สิงหาคม พ.ศ. 2553
ToolStripLabelItem
แถบเมนูที่เป็นรูปแบบ Office2007 เป็นเมนูแบบที่คลิ้กไม่ได้ ใช้แสดงหัวข้อ หรือกลุ่มของรายการเมนูย่อย
ให้ dowload source code ด้านล่างนี้ไป compile เข้ากับ project ของคุณ หลังจากนั้นเวลาที่สร้างเมนูใหม่ จะมีตัวเลือก "LabelItem" มาให้เลือก (ตามรูปตัวอย่าง)
Download source code: ToolStripLabelItem.cs
ให้ dowload source code ด้านล่างนี้ไป compile เข้ากับ project ของคุณ หลังจากนั้นเวลาที่สร้างเมนูใหม่ จะมีตัวเลือก "LabelItem" มาให้เลือก (ตามรูปตัวอย่าง)
Download source code: ToolStripLabelItem.cs
ป้ายกำกับ:
Menu
Database.NET (A MultiDatabase Manager)
โปรแกรมนี้สามารถเชื่อมต่อเข้ากับฐานข้อมูลได้หลากหลายชนิด อาทิ
รองรับ Syntax Highlight และคำสั่งต่าง ๆ ที่จำเป็นของฐานข้อมูลนั้น ๆ
พัฒนาด้วย .NET(2, 3.5)
สามารถ download ไปใช้ได้ฟรี
ไฟล์โปรแกรมมีไฟล์เดียว ขนาดประมาณ 7 MB. (ไม่จำเป็นต้องติดตั้ง copy, paste ใช้ได้เลย)
ไปที่เว็บไซต์ของผู้พัฒนาโปรแกรม http://fishcodelib.com/Database.htm
- MS-Access
- MS-Excel
- dBase
- FireBird
- MySQL
- SQL Server
- SQL Azure
- SQL Server CE
- SQLite
- PostgreSQL
- Oracle
- OLE DB
- ODBC
รองรับ Syntax Highlight และคำสั่งต่าง ๆ ที่จำเป็นของฐานข้อมูลนั้น ๆ
พัฒนาด้วย .NET(2, 3.5)
สามารถ download ไปใช้ได้ฟรี
ไฟล์โปรแกรมมีไฟล์เดียว ขนาดประมาณ 7 MB. (ไม่จำเป็นต้องติดตั้ง copy, paste ใช้ได้เลย)
ไปที่เว็บไซต์ของผู้พัฒนาโปรแกรม http://fishcodelib.com/Database.htm
ป้ายกำกับ:
Database
PopupTipTimer
เป็น Control ที่ดูคล้าย ToolTip สามารถกำหนดเวลาได้ว่าจะแสดงนานแค่ไหน (เป็น 1/1000 วินาที)
ตัวอย่างการใช้งาน
Download Source Code: PopupTipTimer.cs
![]() |
| ภาพก่อนแสดง PopupTipTimer |
![]() |
| ภาพขณะแสดง PopupTipTimer |
ตัวอย่างการใช้งาน
using System;
using System.Drawing;
using System.Windows.Forms;
using Stone.WinUI;
namespace TestPro
{
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
this.popupTip = new PopupTipTimer();
this.popupTip.BackColor = Color.Silver;
}
private PopupTipTimer popupTip;
private void textBox1_Enter(object sender, EventArgs e)
{
this.popupTip.ShowDuration(this.textBox1,
"Please fill customer name",
"Do not leave blank for this field, this is important information.",
ToolTipIcon.None,
Properties.Resources.User1,
8000);
}
}
}
Download Source Code: PopupTipTimer.cs
ป้ายกำกับ:
ToolTip
วันพฤหัสบดีที่ 5 สิงหาคม พ.ศ. 2553
Calendar Winforms Control
![]() |
| Screen short |
![]() |
| Class Diagram |
Update: April 11, 2011 + Demo for VB.Net
Download Here include sourcecode, demo(c#, vb.net)
Modify by : thammapat[at]gmail.com
Job base on : Calendar of Jose Menendez Póo (link to original: http://www.codeproject.com/KB/docview/WinFormsCalendarView.aspx)
Modify date : October 30, 2009
Change Log:
- Calendar class
- Inherit from class Control instead of ScrollableControl.
- Add vertical scrollbar for DaysMode.Expanded view.
- Add event 'ItemDrawContent'
- Add method 'BeginUpdate' and 'EndUpdate'.
- Add property 'MultiSelect', 'RendererMode'
- Add ToolTip component
- Add Icon
- Override 'PreProcessMessage' for supported keyboard navigator(left, right, up, down, pageup, pagedown) and editing item(insert, del, escape, f2).
- Override 'WndProc' to force focus after key down.
- Change some property name to shortly.
- Change method 'ScrollCalendar' from move a week -> move a month.
- Change all event signature to EventHandler
style. - Adjust FinalizeEditMode.
- Adjust draw item content.
- Adjust xml document.
- Double check before raise event 'ItemDatesChanged' is realy changed.
- CalendarItemCollection class
- Add method 'Sort' when 'CollectionChanged'
- CalendarItem class
- Add Property: ToolTipText, Values, Visible.
- Add Method: GetValue, LoadDataRow
- Implement interface ICloneable
- Adjust resizing, dragging behavior
- CalendarSystemRenderer class
- Change some color
- MonthView class
- Inherit from class Control instead of ContainerControl.
- Add Icon
- Add Method: SetSelectionRange(start, end)
- Add event 'DateChanged'.
- Add ContextMenuStrip when mouseup at title Month or Year.
- Override 'PreProcessMessage' for supported keyboard navigator(left, right, up, down, pageup, pagedown)
- Override 'WndProc' to force focus after key down.
- Adjust OnMouseMove when highlighting date[s], event 'SelectionChanged' will be raise after mouse up.
- Adjust OnMouseDown when clicked at gray text, go to that month.
- Adjust xml document.
- Change property name from 'DayGrayedText' -> 'TrailingForeColor'
- Remove property 'MonthTitleColorInActive', 'MonthTitleTextColorInActive'
ป้ายกำกับ:
Calendar
วันเสาร์ที่ 1 พฤษภาคม พ.ศ. 2553
PHP กับ IIS7 ง่ายมาก ๆ
เมื่อก่อนคนที่ใช้ windows ถ้าจะทำงานกับ php แล้วนอกจากจะต้องโหลด php มาลงแล้ว ก็ต้องตาม set โน่นนี่อีกหลายอย่าง ทีนี้พอเป็น IIS7 ปั๊บ ง่ายเลย เข้าไปที่ http://php.iis.net/ แล้วกดที่ Install PHP แล้วก็ next ๆ ไปเรื่อย ๆ (ติดตั้งผ่าน Web PlatForm) ตัว setup นี้จะโหลดโปรแกรมที่เกี่ยวข้องพร้อมกับ setup ให้ IIS7 ของเราใช้ php ได้เลย
ง่ายจริง ๆ
ง่ายจริง ๆ
วันพฤหัสบดีที่ 25 มีนาคม พ.ศ. 2553
.net 2 กับ ActiveControl ที่ขัด ๆ กับที่คิดไว้
เดิมใน .net 1.1 ถ้าเรียกใช้ ActiveControl จะบ่งถึงตัว Control ที่กำลัง Active อยู่ แต่ใน .net 2 จะบอกตามชั้นคือ
Form
|-- UserControl
|-- Button
ขณะที่ Button กำลัง Active และเรียก property ActiveControl เราจะได้ค่า "UserControl" แทนที่จะเป็น Button
Work around
Control activeControl = base.ActiveControl;
if (activeControl is IContainerControl)
{
IContainerControl container = activeControl as IContainerControl;
activeControl = container.ActiveControl;
}
Form
|-- UserControl
|-- Button
ขณะที่ Button กำลัง Active และเรียก property ActiveControl เราจะได้ค่า "UserControl" แทนที่จะเป็น Button
Work around
Control activeControl = base.ActiveControl;
if (activeControl is IContainerControl)
{
IContainerControl container = activeControl as IContainerControl;
activeControl = container.ActiveControl;
}
ป้ายกำกับ:
ActiveControl,
Form
วันศุกร์ที่ 12 มีนาคม พ.ศ. 2553
ขึ้นบรรทัดใหม่ใน SQL-Transact
วันนี้มีโอกาสต้องเขียน function สำหรับ get ข้อมูลหลาย ๆ table มารวมกันให้เหลือบรรทัดเดียว แต่พอข้อมูลมันมีเยอะเข้าเลยดูยาก ก็เลยอยากจะให้มันแยกบรรทัดด้วย กลับไปดูของเก่า ๆ อ้อ เคยทำไว้แล้ว ม้นต้องเชื่อมด้วย Char(10)+ Char(13) ทีนี้ output มันจะออกมาแบบนี้
1002999393 VISA 2,500.00,
2001029992 MAST 4,225.00,
1000229291 VISA 1,988.25
-- * ฟังก์ชั่น FormatNumber ให้ดูที่ http://www.novicksoftware.com/udfOfWeek/Vol1/T-SQL-UDF-Volume-1-Number-48-formatnumber.htm
-- ==========
Create Function GetMultiLineCreditCardInfo(@docno varchar(30))
Returns varchar(1000)
As
Begin
Declare
@field_Return varchar(1000),
@delimiter varchar(4)
SET @delimiter = ', ' + Char(10)+ Char(13)
Select @field_Return = Coalesce(@field_Return + @delimiter, '')
+ ( IsNull(CreditCardID, '') + ' ' + IsNull(CreditCardType, '') + ' ' + dbo.FormatNumber(NetAmount, '2', ',', 'zero') )
From CreditCard
Where RefDocument = @docno
Return @field_Return
End
1002999393 VISA 2,500.00,
2001029992 MAST 4,225.00,
1000229291 VISA 1,988.25
-- * ฟังก์ชั่น FormatNumber ให้ดูที่ http://www.novicksoftware.com/udfOfWeek/Vol1/T-SQL-UDF-Volume-1-Number-48-formatnumber.htm
-- ==========
Create Function GetMultiLineCreditCardInfo(@docno varchar(30))
Returns varchar(1000)
As
Begin
Declare
@field_Return varchar(1000),
@delimiter varchar(4)
SET @delimiter = ', ' + Char(10)+ Char(13)
Select @field_Return = Coalesce(@field_Return + @delimiter, '')
+ ( IsNull(CreditCardID, '') + ' ' + IsNull(CreditCardType, '') + ' ' + dbo.FormatNumber(NetAmount, '2', ',', 'zero') )
From CreditCard
Where RefDocument = @docno
Return @field_Return
End
ป้ายกำกับ:
sql
วันพฤหัสบดีที่ 11 มีนาคม พ.ศ. 2553
An error occurred while parsing EntityName. Line 2, position 65.
ใน VS2008 พอเปิด project และพยายามจะเปิดฟอร์มที่เคยสร้างไว้จะพบ error นี้ทุกครั้ง ทั้ง ๆ ที่ตอนสร้าง project ก็ปกติดี โดยมีข้อความแจ้งว่า
An error occurred while parsing EntityName. Line 2, position 65.
พอ search ไปในเน็ต (อ้างอิง VS2005 Beta 2 form designer problem: error while parsing EntityName) พบว่ามีอักษรบางตัวใน path ถูกตีความผิดไปคืออักษร "&"
จากตัวอย่างใน project นี้เก็บอยู่ที่โฟลเดอร์ D:\Downloads\Control Report&Print\Report RDL\RecursiveData\RecursiveData
พอเปลี่ยนชื่อโฟลเดอร์ใหม่เป็น D:\Downloads\Control Report-Print\Report RDL\RecursiveData\RecursiveData
ทุกอย่างก็กลับสู่ปกติ
ป้ายกำกับ:
ide
วันจันทร์ที่ 8 มีนาคม พ.ศ. 2553
ให้ IDE หยุดตรงที่ Debug (เฉพาะเงื่อนไขที่กำหนดเท่านั้นนะ)
นี้เป็นเทคนิคในการ debug โค้ด ปกติเราจะกด F9 เพื่อทำการ mark บรรทัดที่ต้องการให้ ide หยุดรอที่บรรทัดนั้น แต่ทีนี้พอกด run(F5) ทีไร ก็ต้องมาหยุดรอที่บรรทัดนี้ทุกที บางทีเราก็ไม่ได้ต้องการแบบนั้น อยากให้หยุดเฉพาะเมื่อเข้าเงื่อนไขเท่านั้น
จริง ๆ แล้วตัว ide มีความสามารถนี้อยู่แล้วครับ หลังจากที่ทำการ mark จุดที่จะ debug แล้ว ให้คลิ้กขวาที่จุดนั้น แล้วเลือก Condition... ตามรูป
ทีนี้เมื่อโค้ดวิ่งมาถึงบรรทัดที่ mark ไว้ จะหยุดเฉพาะเมื่อตัวแปร dictQuery == null เท่านั้น
จริง ๆ แล้วตัว ide มีความสามารถนี้อยู่แล้วครับ หลังจากที่ทำการ mark จุดที่จะ debug แล้ว ให้คลิ้กขวาที่จุดนั้น แล้วเลือก Condition... ตามรูป
ทีนี้เมื่อโค้ดวิ่งมาถึงบรรทัดที่ mark ไว้ จะหยุดเฉพาะเมื่อตัวแปร dictQuery == null เท่านั้น
สร้างรายงานอันแรกด้วย RDLC
สิ่งที่ต้องการทำคือ สร้างรายงาน rdlc จาก vs2008 แล้วค่อยมาดึง query(ถูกสร้างพร้อมกับ TableAdaper) ที่อยู่ในรายงานไปใช้อีกที ด้วยการทำ DeSerialized วิธีการสร้าง ReportDefination จากไฟล์ xsd ให้ดูที่ Lesson 2: Generate Classes from the RDL Schema using the xsd Tool
ขั้นตอนคือสร้าง form เปล่าแล้วโค้ดตามนี้เลย
ขั้นตอนคือสร้าง form เปล่าแล้วโค้ดตามนี้เลย
1 using System;
2 using System.Collections.Generic;
3 using System.Data;
4 using System.IO;
5 using System.Windows.Forms;
6 using System.Xml;
7 using System.Xml.Serialization;
8 using Accsa.Data;
9 using Accsa.Data.DAL;
10 using Microsoft.Reporting.WinForms;
11 12 namespace WindowsFormsApplication1
13 {14 public partial class Form1 : Form
15 {16 public Form1()
17 { 18 InitializeComponent(); 19 } 20 21 private Microsoft.Reporting.WinForms.ReportViewer reportViewer1;
22 23 private void Form1_Load(object sender, EventArgs e)
24 {25 XmlReader xrd = XmlReader.Create(Path.Combine(Application.StartupPath, "Report1.rdlc"));
26 xrd.Read();
27 XmlSerializer serialize = new XmlSerializer(typeof(Rdlc.Report));
28 Rdlc.Report rpt = (Rdlc.Report)serialize.Deserialize(xrd);
29 30 // create list of item element name.
31 32 List<Rdlc.ItemsChoiceType37> choice37 = new List<Rdlc.ItemsChoiceType37>(rpt.ItemsElementName);
33 int DataSetsIndex = choice37.IndexOf(Rdlc.ItemsChoiceType37.DataSets);
34 35 Rdlc.DataSetsType dstype = rpt.Items[DataSetsIndex] as Rdlc.DataSetsType;
36 foreach (var item in dstype.DataSet)
37 {38 Rdlc.DataSetType dtype = item as Rdlc.DataSetType;
39 Rdlc.QueryType qtype = Array.Find<object>(dtype.Items, (oo) =>
40 {41 return oo.GetType() == typeof(Rdlc.QueryType);
42 }) as Rdlc.QueryType;
43 44 List<Rdlc.ItemsChoiceType2> choice2 = new List<Rdlc.ItemsChoiceType2>(qtype.ItemsElementName);
45 int indexCommandText = choice2.IndexOf(Rdlc.ItemsChoiceType2.CommandText);
46 int indexCommandType = choice2.IndexOf(Rdlc.ItemsChoiceType2.CommandType);
47 int indexDatasourceName = choice2.IndexOf(Rdlc.ItemsChoiceType2.DataSourceName);
48 int indexQueryParas = choice2.IndexOf(Rdlc.ItemsChoiceType2.QueryParameters);
49 50 dictQuery.Add(item.Name, qtype.Items[indexCommandText].ToString());
51 //string commandType = qtype.Items[indexCommandType].ToString();
52 string datasourceName = qtype.Items[indexDatasourceName].ToString();
53 //Rdlc.QueryParametersType qParas = qtype.Items[indexQueryParas] as Rdlc.QueryParametersType;
54 } 55 56 57 this.timer1.Start();
58 } 59 60 /// <summary>
61 /// CommandText DataSet_DataTable, CommandText
62 /// </summary>
63 Dictionary<string, string> dictQuery = new Dictionary<string, string>();
64 65 private void timer1_Tick(object sender, EventArgs e)
66 {67 this.timer1.Stop();
68 69 DataSet ds = new DataSet("DSReport");
70 71 using (AsAdapter da= new AsAdapter())
72 {73 da.ConnectionInfo = new ConnectionInfo();
74 da.ConnectionInfo.SetConnectionString("localhost", "db2006", "sa", "system");
75 da.Open();
76 foreach (var item in dictQuery)
77 {78 DataTable dt = da.GetData(item.Value, item.Key.Split('_')[1]);
79 ds.Tables.Add(dt);
80 }81 da.Close();
82 }83 this.reportViewer1 = new ReportViewer();
84 this.reportViewer1.ProcessingMode = ProcessingMode.Local;
85 this.reportViewer1.LocalReport.ReportPath = "Report1.rdlc";
86 87 for (int i = 0; i < ds.Tables.Count; i++)
88 {89 string datasource_Name = string.Format("{0}_{1}", ds.DataSetName, ds.Tables[i].TableName);
90 ReportDataSource rds = new ReportDataSource(datasource_Name, ds.Tables[i]);
91 this.reportViewer1.LocalReport.DataSources.Add(rds);
92 } 93 94 95 this.reportViewer1.Dock = DockStyle.Fill;
96 this.Controls.Add(this.reportViewer1);
97 98 this.reportViewer1.RefreshReport();
99 } 100 101 } 102 }
สมัครสมาชิก:
บทความ (Atom)











