|
![](/images/resource/spacer.gif) |
|
สอบถามการออก รายงานแสดงผลรูปภาพหน่อยครับ Crystal Report |
|
![](/images/resource/viewboard_01.gif?v=1001) |
|
|
![](/images/resource/viewboard_03.gif?v=1001) |
![](/images/resource/viewboard_04.gif?v=1001) |
|
ต้องการให้ภาพออกมาในลักษณะนี้ครับ
![wa wa](https://www.thaicreate.com/upload/stock/20170228163249.png?v=1001)
แต่ภาพที่ออกมาเป็นแบบนี้ ครับ ถ้าเรียงเหมือนภาพข้างบนข้อมูลจะซ้ำกันครับ
![trrrdd trrrdd](https://www.thaicreate.com/upload/stock/20170228163406.png?v=1001)
code ส่งไป Report ตามนี้ครับ
Code (C#)
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using CrystalDecisions.CrystalReports.Engine;
namespace ProgramDemoHR
{
public partial class Reportcard : DevExpress.XtraEditors.XtraForm
{
DataTable dt = new DataTable();
public Reportcard()
{
InitializeComponent();
this.btnadd.Click += new EventHandler(btnadd_Click);
ShowreportCard1();
}
private void btnadd_Click(object sender, EventArgs e)
{
string str = "";
for (int i = 0; i < gridView1.RowCount; i++)
{
//Console.WriteLine(gridView1.GetRowCellValue(i, "chk"));
if (Convert.ToBoolean(gridView1.GetRowCellValue(i, "chk")) == true)
{
str += gridView1.GetRowCellValue(i, "employee_ID") + ",";
}
}
if (str != "")
{
str = str.Substring(0, str.Length - 1);
ShowReportCard(str);
}
}
private void ShowreportCard1()
{
DataTable dt = new DataTable();
string sql = "SELECT cast(0 as bit) As chk,employee.Emp_ID, employee.employee_ID, employee.nameth, employee.startday,dept.dept_name, position.pos_nameth, position.pos_nameeng, party.party_name, employee.pic FROM tbl_Employee AS employee INNER JOIN tbl_Position AS position ON employee.position_ID = position.position_ID INNER JOIN tbl_Party AS party ON employee.party_ID = party.party_ID INNER JOIN tbl_Department AS dept ON employee.dept_ID = dept.dept_ID WHERE employee.statusemp_ID = '1' AND employee.employee_ID LIKE '1%'";
dt = connect_db.SelectData(sql);
dgvmaincardcode1.DataSource = dt;
}
private void ShowReportCard(string id)
{
DataTable dt = new DataTable();
string sql = "SELECT employee.Emp_ID, employee.employee_ID, employee.nameth, employee.startday, position.pos_nameth, dept.dept_name, position.pos_nameeng, party.party_name, employee.pic FROM tbl_Employee AS employee INNER JOIN tbl_Position AS position ON employee.position_ID = position.position_ID INNER JOIN tbl_Party AS party ON employee.party_ID = party.party_ID INNER JOIN tbl_Department AS dept ON employee.dept_ID = dept.dept_ID WHERE employee.Employee_ID In (" + id + ") AND employee.statusemp_ID = '1' AND employee.employee_ID LIKE '1%'";
dt = connect_db.SelectData(sql);
dt.Columns.Add("picImg", System.Type.GetType("System.Byte[]"));
for (int i = 0; i < dt.Rows.Count; i++)
{
//Console.WriteLine(("\\192.168.0.8\pic\"+dt.Rows[i]["pic"].ToString()));
dt.Rows[i]["picImg"] = setImageToDatatable(@"\\127.0.0.1\pic\" + dt.Rows[i]["pic"]);
}
viewreport rptf = new viewreport();
CrystalReport2 rpt = new CrystalReport2();
rpt.SetDataSource(dt);
rptf.crv.ReportSource = rpt;
rptf.Show();
}
private Byte[] setImageToDatatable(string URL)
{
Byte[] buffer;
Byte[] pic;
buffer = System.IO.File.ReadAllBytes(URL);
System.IO.MemoryStream stream = new System.IO.MemoryStream(buffer);
System.IO.BinaryReader binReader = new System.IO.BinaryReader(stream);
pic = binReader.ReadBytes((int)stream.Length);
return pic;
}
}
}
Tag : .NET, Ms SQL Server 2008, Crystal Report, Win (Windows App), C#
![](/images/adv.jpg?v=1001)
|
|
![](/images/resource/blockviewtopic_01.gif?v=1001) |
![](/images/resource/blockviewtopic_02.gif?v=1001) |
![](/images/resource/blockviewtopic_03.gif?v=1001) |
![](/images/resource/blockviewtopic_04.gif?v=1001) |
Date :
2017-02-28 16:36:44 |
By :
kittisak30 |
View :
1542 |
Reply :
3 |
|
![](/images/resource/blockviewtopic_06.gif?v=1001) |
![](/images/resource/blockviewtopic_07.gif?v=1001) |
![](/images/resource/blockviewtopic_08.gif?v=1001) |
![](/images/resource/blockviewtopic_09.gif?v=1001) |
|
|
|
![](/images/resource/viewboard_06.gif?v=1001) |
![](/images/resource/viewboard_07.gif?v=1001) |
|
![](/images/resource/viewboard_08.jpg?v=1001) |
![](/images/resource/viewboard_09.gif?v=1001) |
![](/images/resource/viewboard_01.gif?v=1001) |
|
|
![](/images/resource/viewboard_03.gif?v=1001) |
![](/images/resource/viewboard_04.gif?v=1001) |
|
กำหนดให้แสดงผลแบบ Column ได้ครับ
|
![](/images/resource/blockviewtopic_01.gif?v=1001) |
![](/images/resource/blockviewtopic_02.gif?v=1001) |
![](/images/resource/blockviewtopic_03.gif?v=1001) |
![](/images/resource/blockviewtopic_04.gif?v=1001) |
Date :
2017-02-28 21:30:04 |
By :
mr.win |
|
![](/images/resource/blockviewtopic_06.gif?v=1001) |
![](/images/resource/blockviewtopic_07.gif?v=1001) |
![](/images/resource/blockviewtopic_08.gif?v=1001) |
![](/images/resource/blockviewtopic_09.gif?v=1001) |
|
|
![](/images/resource/viewboard_06.gif?v=1001) |
![](/images/resource/viewboard_07.gif?v=1001) |
|
![](/images/resource/viewboard_08.jpg?v=1001) |
![](/images/resource/viewboard_09.gif?v=1001) |
![](/images/resource/viewboard_01.gif?v=1001) |
|
|
![](/images/resource/viewboard_03.gif?v=1001) |
![](/images/resource/viewboard_04.gif?v=1001) |
|
ได้แล้วครับ ขอบคุรมากครับ Admin
|
![](/images/resource/blockviewtopic_01.gif?v=1001) |
![](/images/resource/blockviewtopic_02.gif?v=1001) |
![](/images/resource/blockviewtopic_03.gif?v=1001) |
![](/images/resource/blockviewtopic_04.gif?v=1001) |
Date :
2017-02-28 23:36:23 |
By :
kittisak30 |
|
![](/images/resource/blockviewtopic_06.gif?v=1001) |
![](/images/resource/blockviewtopic_07.gif?v=1001) |
![](/images/resource/blockviewtopic_08.gif?v=1001) |
![](/images/resource/blockviewtopic_09.gif?v=1001) |
|
|
![](/images/resource/viewboard_06.gif?v=1001) |
![](/images/resource/viewboard_07.gif?v=1001) |
|
![](/images/resource/viewboard_08.jpg?v=1001) |
![](/images/resource/viewboard_09.gif?v=1001) |
![](/images/resource/viewboard_01.gif?v=1001) |
|
|
![](/images/resource/viewboard_03.gif?v=1001) |
![](/images/resource/viewboard_04.gif?v=1001) |
|
จัดไปครับ
|
![](/images/resource/blockviewtopic_01.gif?v=1001) |
![](/images/resource/blockviewtopic_02.gif?v=1001) |
![](/images/resource/blockviewtopic_03.gif?v=1001) |
![](/images/resource/blockviewtopic_04.gif?v=1001) |
Date :
2017-03-01 09:46:18 |
By :
mr.win |
|
![](/images/resource/blockviewtopic_06.gif?v=1001) |
![](/images/resource/blockviewtopic_07.gif?v=1001) |
![](/images/resource/blockviewtopic_08.gif?v=1001) |
![](/images/resource/blockviewtopic_09.gif?v=1001) |
|
|
![](/images/resource/viewboard_06.gif?v=1001) |
![](/images/resource/viewboard_07.gif?v=1001) |
|
![](/images/resource/viewboard_08.jpg?v=1001) |
![](/images/resource/viewboard_09.gif?v=1001) |
|
|
|
![](/images/digitalocean-banner.jpg)
|
Load balance : Server 05
|