Click here to Skip to main content
15,886,540 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: Edit <head> in page with code behind file - Thanks Pin
Alice@mywonderland3-Apr-07 22:52
Alice@mywonderland3-Apr-07 22:52 
QuestionASP.Net from Scratch Pin
xbiplav3-Apr-07 6:25
xbiplav3-Apr-07 6:25 
AnswerRe: ASP.Net from Scratch Pin
MinhajuddinK3-Apr-07 7:10
MinhajuddinK3-Apr-07 7:10 
QuestionPage-wide state with Master pages? Pin
Tom Welch3-Apr-07 6:11
Tom Welch3-Apr-07 6:11 
AnswerRe: Page-wide state with Master pages? Pin
ToddHileHoffer3-Apr-07 7:58
ToddHileHoffer3-Apr-07 7:58 
GeneralRe: Page-wide state with Master pages? Pin
Tom Welch3-Apr-07 11:05
Tom Welch3-Apr-07 11:05 
Questionprinting a code behind textbox text value Pin
indian1433-Apr-07 5:53
indian1433-Apr-07 5:53 
QuestionPLease help getting error as The process cannot access the file 'D:\Inventracksys\Inventorytracking Vendorwisereport_1.emf' because it is being used by another process Pin
mohd imran abdul aziz3-Apr-07 4:33
mohd imran abdul aziz3-Apr-07 4:33 
Dear All,
I am making web application using Asp.net C#(Visual Studio2005). And Sql server 2005 as a back End
I generated local mode report but as there was no printing option available . I assign printing feature to button click by exporting the data to EMF format and print
Now when I run it through IDE VS2005 then it does not show any error.
But when I run in through IIS in intranet it showing me this error

The process cannot access the file 'D:\Inventracksys\Inventorytracking Vendorwisereport_1.emf' because it is being used by another process
Where I am going wrong please guide me.
Code used are
Button click code
protected void Btnprint_Click(object sender, EventArgs e)
{
LocalReport report = new LocalReport();
vw_tranTableAdapter da = new vw_tranTableAdapter();
report.ReportPath = @"D:\Inventracksys\inventorytracking\Vendorwisereport.rdlc";
report.DataSources.Add(new ReportDataSource("tran_vw_tran", da.GetDataByvendor(RadioButtonList1.SelectedValue, DropDownListvendor.SelectedValue)));
export(report);
m_currentpageindex = 0;
Print();
}

Creating stream as
private Stream CreateStream(string name, string filenameextension, Encoding encoding, string mimetype, bool willseek)
{
Stream stream = new FileStream(@"D:\Inventracksys\Inventorytracking " + name + "." + filenameextension, FileMode.Create );
//Stream stream = new FileStream(name + "." + filenameextension, FileMode.Create);
m_streams.Add(stream);
return stream;
}

Exporting to EMF

private void export(LocalReport report)
{
string deviceInfo = "<deviceinfo>" + " <outputformat>EMF" + " <pagewidth>9in" + " <pageheight>12in" + " <margintop>0.25in" + " <marginleft>0.25in" + " <marginright>0.25in" + " <marginbottom>0.25in" + ""; Warning[] warnings; m_streams = new List<stream>(); report.Render("Image", deviceInfo, CreateStream, out warnings);
foreach (Stream stream in m_streams) stream.Position = 0;

}
Printhandler event


private void PrintPage(object sender, PrintPageEventArgs ev)
{
Metafile pageImage = new
Metafile(m_streams[m_currentpageindex ]);
ev.Graphics.DrawImage(pageImage , ev.PageBounds);
m_currentpageindex++;
ev.HasMorePages = (m_currentpageindex < m_streams.Count); }

printing option


private void Print()
{
const string printerName =
"Microsoft Office Document Image Writer";
if (m_streams == null || m_streams.Count == 0)
return;
PrintDocument printDoc = new PrintDocument();
printDoc.DefaultPageSettings.Landscape = true;
printDoc.PrinterSettings.PrinterName = printerName;
// lblerrmsg.Text = printDoc.PrinterSettings.PrinterName;


if (!printDoc.PrinterSettings.IsValid)
{
string msg = String.Format(
"Can't find printer \"{0}\".", printerName);
//MessageBox.Show(msg, "Print Error");
lblerrmsg.Text = "Print Error";
return;
}

printDoc.PrintPage += new PrintPageEventHandler(PrintPage);
printDoc.Print();
}
public void Dispose()
{
if (m_streams != null)
{
foreach (Stream stream in m_streams)
stream.Close();
m_streams = null;
}
}

Now when I run it through IDE VS2005 then it does not show any error.
But when I run in through IIS in intranet it showing me this error

The process cannot access the file 'D:\Inventracksys\Inventorytracking Vendorwisereport_1.emf' because it is being used by another process
Where I am going wrong please guide me.
Thanks




regards
imran khan

Questiondate range search Pin
Kunal P3-Apr-07 4:24
Kunal P3-Apr-07 4:24 
QuestionRun time access Pin
viveknair203-Apr-07 4:02
viveknair203-Apr-07 4:02 
AnswerRe: Run time access Pin
Jaiprakash M Bankolli3-Apr-07 4:21
Jaiprakash M Bankolli3-Apr-07 4:21 
Questionsending a message Pin
Oga M3-Apr-07 3:53
Oga M3-Apr-07 3:53 
QuestionDynamically created button holding relevant data Pin
joon vh.3-Apr-07 3:52
joon vh.3-Apr-07 3:52 
AnswerRe: Dynamically created button holding relevant data Pin
Venkatesh Mookkan3-Apr-07 19:07
Venkatesh Mookkan3-Apr-07 19:07 
Question2 connect compare validator wit database [modified] Pin
mvj_asp3-Apr-07 2:22
mvj_asp3-Apr-07 2:22 
AnswerRe: 2 connect compare validator wit database Pin
Not Active3-Apr-07 3:36
mentorNot Active3-Apr-07 3:36 
Questionpop up blocker Pin
harsh_c3-Apr-07 2:13
professionalharsh_c3-Apr-07 2:13 
AnswerRe: pop up blocker Pin
kubben3-Apr-07 2:25
kubben3-Apr-07 2:25 
GeneralRe: pop up blocker Pin
harsh_c4-Apr-07 2:25
professionalharsh_c4-Apr-07 2:25 
QuestionArchitectural discussion of Digital Signature - Detached or embedded? Pin
priyank853-Apr-07 2:11
priyank853-Apr-07 2:11 
QuestionJoin Query in sql Pin
samsonx3-Apr-07 1:16
samsonx3-Apr-07 1:16 
AnswerRe: Join Query in sql Pin
ToddHileHoffer3-Apr-07 4:08
ToddHileHoffer3-Apr-07 4:08 
AnswerRe: Join Query in sql Pin
Jaiprakash M Bankolli3-Apr-07 4:27
Jaiprakash M Bankolli3-Apr-07 4:27 
GeneralRe: Join Query in sql Pin
ToddHileHoffer3-Apr-07 4:47
ToddHileHoffer3-Apr-07 4:47 
QuestionForms Authentication For MultiProject Solution Pin
shareknk3-Apr-07 0:43
shareknk3-Apr-07 0:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.