我有一個客戶的號碼,我想看看圖像並打印輸出 你如何打印的照片在水晶報表如何打印照片的水晶報表
-1
A
回答
0
私人無效的LoadImage(DataRow的objDataRow,串strImageField, FilePath) { try FileSream fs = new FileStream(FilePath, System.IO.FileMode.Open,System.IO.FileAccess.Read); byte [] Image = new byte [fs.Length]; fs.Read(圖像,0,Convert.ToInt32(fs.Length)); fs.Close(); objDataRow [strImageField] =圖像; } 趕上(異常前) { //Response.Write( 「」 + ex.Message + 「」); }}
???????????????????????????????? ................................
OleDbCommand Cmd = new OleDbCommand(); OleDbDataAdapter的myAdapter =新OleDbDataAdapter的(); Cmd.CommandText = 「選擇CCONT,從SaveImage其中CCONT =圖像 '」 + textBoxet.Text + 「'」; Cmd.Connection = myConn;
myAdapter.SelectCommand = Cmd;
try
{
myConn.Open();
myAdapter.Fill(ds.Tables[0]);
myConn.Close();
}
catch (Exception ex)
{
throw;
}
for (int index = 0; index < ds.Tables[0].Rows.Count; index++)
{
if (ds.Tables[0].Rows[index]["image"].ToString() != "")
{
string s = ds.Tables[0].Rows[index]["image"].ToString();
if (File.Exists(s))
{
LoadImage(ds.Tables[0].Rows[index], "image", s);
}
else
{
LoadImage(ds.Tables[0].Rows[index], "image",
"DefaultPicturePath");
}
}
else
{
LoadImage(ds.Tables[0].Rows[index], "image",
"DefaultPicturePath");
}
}
try
{
// Finally display report in crystal report viewer
ReportDocument crDoc = new ReportDocument();
crDoc.Load("CrystalReport1.rpt");
crDoc.SetDataSource(ds.Tables[0]);
}
你有沒有嘗試過的東西! – 2016-12-06 07:04:37