使用Foxpro和c#的Crystal Report登录失败 [英] Crystal Report Logon Failed with Foxpro and c#

查看:57
本文介绍了使用Foxpro和c#的Crystal Report登录失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

请我急需帮助



我是Crystal新手,我遇到很多问题而没有找到正确的解决方案!!!



我开发了一个Windows窗体c#2010应用程序,显示水晶10,数据库是FOXPRO。



我试图在代码中设置登录详细信息,因为数据源位置可以更改,但是我一直登录失败,我不明白为什么



我需要帮助!!!!!



另外,我试图在客户端的机器上运行我的应用程序(win 7 64bit)和我我无法运行水晶报告,我得到了crystaldecisions的错误* dll和共享* dll



我不知道我还需要安装什么,我已经安装了sap crystal .net framework 4它仍然无法正常工作,我不想在客户端的机器上安装Crystal。我错过了什么?



我厌倦了搜索,因为有很多不同的解决方案,而且它们对我不起作用!!!



请帮助我!



谢谢!!!

Sahira Zaman

Hi there,
Please I am desperate for help

I am new to Crystal and I am having so many issues without finding the correct solution!!!

I have developed a windows form c# 2010 app that shows crystal 10 and the database is FOXPRO.

I am trying to set the logon details in the code as the datasource location can change, however I keep getting "Logon Failed" and I don't understand why

Please I need help!!!!!

Also, I tried to run my app in the client's machine (win 7 64bit) and I am not able to run the crystal reports, I get error with crystaldecisions*dll & shared*dll

I don't know what else do I have to install, I already installed sap crystal .net framework 4 it's still not working, I don't want to have to install Crystal in the client's machine. What am I missing?

I am so sick of searching, as there are so many different solutions and also they did not work for me!!!

Please please please help me!

Thank you!!!
Sahira Zaman

推荐答案

这是第1号问题的解决方案登录失败使用fox pro和crystal in c#

Here is the solution for issue number 1) "Logon failed" using fox pro and crystal in c#
//set only the server name for all tables including DB path + file name (*.dbf)
                    ReportDocument doc = new ReportDocument();
                    ParameterFields paramFields = new ParameterFields();
                    string[] sParamArr = null;

                    doc.Load(frmMainButton._initialParam.ReportLocation + @"\" + _reportName.ToLower());

                    //Tables tables = doc.Database.Tables;
                    foreach (CrystalDecisions.CrystalReports.Engine.Table table in doc.Database.Tables)
                    {
                        table.LogOnInfo.ConnectionInfo.ServerName = frmMainButton._initialParam.DBDataSource + @"\" + table.LogOnInfo.TableName.ToString() + ".DBF";
                        table.ApplyLogOnInfo(table.LogOnInfo);
                    }

                    try
                    {
                        doc.Refresh();
                        doc.VerifyDatabase();
                    }
                    catch (LogOnException engEx)
                    {
                        MessageBox.Show("Incorrect Logon Parameters. Check your user name and password.");
                    }

                    if (_parametersList.Count > 0)
                    {
                        foreach (string s in _parametersList)
                        {
                            sParamArr = s.Split('|');

                            ParameterField pField = new ParameterField();
                            pField.Name = sParamArr[0];
                            pField.ParameterFieldName = sParamArr[0];
                          
                            ParameterDiscreteValue pDValue = new ParameterDiscreteValue();
                            pDValue.Value = sParamArr[1];
                            pField.CurrentValues.Add(pDValue);
                            pField.ReportParameterType = ParameterType.QueryParameter;
                            pField.IsOptionalPrompt = true;
                            pField.HasCurrentValue = true;
                            pField.EnableNullValue = true;
                            
                            paramFields.Add(pField);

                            doc.SetParameterValue(sParamArr[0], sParamArr[1]);
                        }
                        _parametersList.Clear();
                    }
                    
                    doc.Refresh();
                    crystalReportViewer.UseWaitCursor = true;
                    crystalReportViewer.ParameterFieldInfo = paramFields;
                    crystalReportViewer.ReportSource = doc;                    
                    crystalReportViewer.RefreshReport();
                    crystalReportViewer.UseWaitCursor = false;


首先你需要学习如何在.net中使用水晶报告,下面我给出了一些链接。请仔细阅读。



1)C#crystal逐步报告。 [ ^ ]



此链接包含Crystal Report的详细信息。

2)使用生成报告Visual Studio 2010中的Crystal Reports [ ^ ]



3)如何创建基本水晶报告 [ ^ ]



这个版本有点旧但是它可以帮助您深入了解Crystal报表的部署。

4)Crystal Report 2005部署指南。 [ ^ ]



5)将Crystal Reports与VFP一起使用 [ ^ ]



6)VS 2010中的Crystal报表部署。 [ ^ ]







First of all you need to learn how to use crystal report in the .net, Below I have given some links. Please go through it.

1) C# crystal reports step by step.[^]

This link has detailed information on Crystal Report.
2) Generate a Report using Crystal Reports in Visual Studio 2010[^]

3) How to create basic crystal report[^]

This version little bit old but it helps you to get deep understanding of deployment of Crystal report.
4) Crystal Report 2005 Deployment Guide.[^]

5) Using Crystal Reports with VFP[^]

6) Crystal Report Deployment in VS 2010.[^]



引用:

我有另一个问题,如果文件中的数据源位置* .rpt不正确,如果我通过代码在我的应用程序中设置位置,那会有效吗?

I have another question, if the data source location in the file "*.rpt" is incorrect, will that work if I set the location in my application, via code?

你可以这样做。



请在上面阅读有助于解决问题的文章。有关FoxPro的Crystal报告的信息非常少。大多数人都使用带有SQL的.Net + Crystal报告。

You can do that.

Please read above the articles it will helpful to resolve your issue. There are very less information on Crystal report with FoxPro. Most people go with .Net + Crystal report with SQL.


我最后通过发送正确的值和描述修复了参数问题。



最后我搞定了工作



非常感谢
I finally fixed the parameters issue by sending the correct values and description :)

Finally I got it working

Thanks a lot


这篇关于使用Foxpro和c#的Crystal Report登录失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆