I have a C# program with a Crystal Report in it called "DisplayLabel" that
exports to Word to print out labels.
The program works just fine on our production server, but I can't get it to
work on my local development machine or development server.
I can even see the report in "Main Report Preview", but when I run the
program and try to access it in dev I get this error:
Logon failed.
Details: IM002:[Microsoft][ODBC Driver Manager] Data source name not found
and no default driver specified
Error in File C:\Users\disaia\AppData\Local\Temp\DisplayLabel
{A6EC868D-618E-4FE7-ABBF-77460FA24118}.rpt:
Unable to connect: incorrect log on parameters.
This happens when I use reportDocument.ExportToDisk. The program tries to
export the report to Word. It crashes on this line.
The login parameters on the production sql server matches the ones on the
development sql server.
Here is the complete function:
protected void LoadLabels(int Start)
{
ReportDocument reportDocument = new ReportDocument();
reportDocument.Load("C:\\Inetpub\\wwwroot\\ShoeReport\\admin\\DisplayLabel.rpt");
ConnectionInfo ci = new ConnectionInfo();
ci.ServerName = ConfigurationSettings.AppSettings["CRServer"];
ci.DatabaseName = ConfigurationSettings.AppSettings["CRDatabase"];
ci.UserID = ConfigurationSettings.AppSettings["CRUser"];
ci.Password = ConfigurationSettings.AppSettings["CRPassword"];
TableLogOnInfo li;
foreach (CrystalDecisions.CrystalReports.Engine.Table tbl in
reportDocument.Database.Tables)
{
li = tbl.LogOnInfo;
li.ConnectionInfo = ci;
tbl.ApplyLogOnInfo(li);
}
reportDocument.SetParameterValue("@Store", StoreNumber);
reportDocument.SetParameterValue("@StartAt", Start);
reportDocument.SetParameterValue("@SortOrder", SortOrder);
reportDocument.PrintOptions.PaperSize = PaperSize.PaperLetter;
reportDocument.PrintOptions.PaperSource = PaperSource.Auto;
string WordPath;
string FileName;
WordPath = "C:" + "\\Inetpub\\wwwroot\\ShoeReport\\admin\\DOC\\" +
StoreNumber.ToString() + "_DisplayStickers.doc";
FileName = StoreNumber.ToString() + "_DisplayStickers.doc";
if (File.Exists(WordPath))
{
File.Delete(WordPath);
}
bool retVal;
retVal = FileInUse(WordPath);
if (retVal)
{
lblError.Text = "File is already open. Please close it to create
another label sheet.";
}
else
{
lblError.Text = "";
reportDocument.ExportToDisk(ExportFormatType.WordForWindows,
WordPath); //<== It crashes here.
reportDocument.Dispose();
reportDocument = null;
ci = null;
li = null;
iflabels.Attributes["src"] =
Page.ResolveClientUrl("~/Admin/LabelLoad.aspx?file=" + FileName);
}
}
Help please! :-)
--
--
You received this message because you are subscribed to the Google
Groups "DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML
Web Services,.NET Remoting" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/dotnetdevelopment?hl=en?hl=en
or visit the group website at http://megasolutions.net
---
You received this message because you are subscribed to the Google Groups
"DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web
Services,.NET Remoting" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.