Hi guys,
Im trying to run a parameterized crystal report in C# (Visual Studio 2005 Professional) getting values from 3 textbox controls (windows form):
cbCliente is the textbox control for the clients name (string)
DataIni is the textbox control for the initial date (DateTime)
DataFin is the textbox control for the final date (DateTime)
The code below runs just fine, but when I try to add the DataIni and DataFin parameters, it gives an error message:
private void btnFatura_Click(object sender, EventArgs e)
{
string selectFormula = "Mid({qryALL1.Cliente}, 1) = \"" + cbCliente.Text + "\"";
crystalReportViewer1.SelectionFormula = selectFormula;
}
My question is: How do I add the DataIni and DataFin parameters? Ive tried many ways, but they didnt work. Im getting the synthax wrong somewhere:
string selectFormula = "Mid({qryALL1.Cliente}, 1) = " + cbCliente.Text + " AND {qryALL1.Date} in (" + Convert.ToDateTime(DataIni.Text) + ") to (" + Convert.ToDateTime(DataFin.Text) + ")";
Thanks in advance,
JC
Im trying to run a parameterized crystal report in C# (Visual Studio 2005 Professional) getting values from 3 textbox controls (windows form):
cbCliente is the textbox control for the clients name (string)
DataIni is the textbox control for the initial date (DateTime)
DataFin is the textbox control for the final date (DateTime)
The code below runs just fine, but when I try to add the DataIni and DataFin parameters, it gives an error message:
private void btnFatura_Click(object sender, EventArgs e)
{
string selectFormula = "Mid({qryALL1.Cliente}, 1) = \"" + cbCliente.Text + "\"";
crystalReportViewer1.SelectionFormula = selectFormula;
}
My question is: How do I add the DataIni and DataFin parameters? Ive tried many ways, but they didnt work. Im getting the synthax wrong somewhere:
string selectFormula = "Mid({qryALL1.Cliente}, 1) = " + cbCliente.Text + " AND {qryALL1.Date} in (" + Convert.ToDateTime(DataIni.Text) + ") to (" + Convert.ToDateTime(DataFin.Text) + ")";
Thanks in advance,
JC
Last edited by a moderator: