views:

97

answers:

1

hi expert

my question is how to call store procedure and set parameter in c# application for crystal report show.

e.g.

i have table of invoice and field is as below

companyID (int) invno(varchar)

 1                101/2009-2010

 2                101/2009-2010

now suppose i have create store procedure

store proc sel_inv @companyID int

as

select * from invoice where companyID=@companyID

for display cry.report against particulars ID only. if companyID = 1 then select records only companyID = 1 not for 2.

and for that how to call above procedure & pass parameter value into c# for crystal report.

and userID and password always asked while showing of crystal report if there is any solution for set one time userID and password through coding in c# though it's never asked again & again about it for other user.

thanks in advance.....

A: 

You need to load the report into a ReportDocument object, then set the either the parameters using the ParameterFields collection or modify the RecordSelectionFormula, After that, pass the ReportDocument to the viewer. As for the login stuff, look at the ReportDocument's SetDatabaseLogon method.

CodeByMoonlight