0
votes

I have a web form, and I put here a CrystalReportViewer, then have created a blank CrystalReport and give some format.

Then by programatically do a SQL query to a certain Visual FoxPro tables(.dbf). Fill a DataTable and asign this to the DataSource of the CrystalReport.

This works fine, the problema is that if the report have more than 1 sheet when I try to see another sheets then appears a window asking me for login info(Server, Database name, User, Password). The strange thing is that if I do the same but in a Windows Form don´t ask me for this information.

I see in another question that people suggest to use ConnectionInfo, but the problema is that I dont know what is supposed to put here for FoxPro, there is no Database, only tables, and the user and passwords need to be domain user.

I put some code here:

string Con = @"Provider=VFPOLEDB.1;Data Source=\\Server IP\Directory\Subdirectory";

OleDbConnection ConnectionHandler = new OleDbConnection(Con);
OleDbDataAdapter DAT = new OleDbDataAdapter();

string SQL ="SQL query with multiple join´s";

DataSet Ds = new DataSet();
DataTable Table = new DBF_empres.DataTable1DataTable();

OleDbCommand Query = new OleDbCommand(SQL, ConnectionHandler);

Query.Parameters.Add(new OleDbParameter("?", "%" + a));
Query.Parameters.Add(new OleDbParameter("?", "%" + a));

DAT = new OleDbDataAdapter(Query);
DAT.Fill(Table);
ConnectionHandler.Close();

var informe = new CrystalReport2();
informe.SetDataSource(Table);
CrystalReportViewer1.ReportSource = informe;
1

1 Answers

1
votes

the problema is that I dont know what is supposed to put here for FoxPro, there is no Database, only tables,

You probably should look at the following link:

VFP Connection Strings

On that page you might look in particular at:
Free table directory
or
Connect to a single DBF-file

Good Luck