Hi, everyone
I'm a beginner! i have a problem wit Crystal Report v10. I design Crystal Report and when i run it. it show info below:
The report you requested requires further information.
localhost |
Server name: |
< ="" name="Name-localhost" value="localhost" maxlength="255" style="border-style: inset;" readonly="readonly" ="text">
|
Database name: |
< ="" name="Name-localhost" value="" maxlength="255" style="border-style: inset;" readonly="readonly" ="text">
|
User name: |
< ="" id="User-localhost" name="User-localhost" value="" maxlength="255" style="border-style: inset;" ="text">
|
Password: |
< ="" name="-localhost" maxlength="255" style="border-style: inset;" ="">
|
< ="" style="border-style: none;" name="UseIntegratedSecurity-localhost" =""> Use Integrated Security
|
|
< ="" style="border-style: outset;" value="Log On" ="submitLogonValues()" ="">
|
Here my code behind:
TableLogOnInfo myLogOnInfo = new TableLogOnInfo();
CrystalReportViewer1.LogOnInfo = new TableLogOnInfos();
myLogOnInfo.ConnectionInfo.ServerName = @"localhost";
myLogOnInfo.ConnectionInfo.DatabaseName = "ERPapps";
myLogOnInfo.TableName = "tblNhanVien";
myLogOnInfo.ConnectionInfo.UserID = "";
myLogOnInfo.ConnectionInfo.Password = "";
string strQuery = " SELECT NhanVien.MaNV, NhanVien.HoNV, NhanVien.TenNV, NhanVien.NgaySinh, NhanVien.GioiTinh, PhongBan.TenPhongBan FROM NhanVien INNER JOIN PhongBan ON NhanVien.MaPhong = PhongBan.MaPhong";
DataSet dsNhanVien = new DataSet();
SqlDataAdapter sqlDataAdapter = new SqlDataAdapter(strQuery, ConfigurationManager.ConnectionStrings["ERPappsConnectionString"].ConnectionString);
sqlDataAdapter.Fill(dsNhanVien,"tblNhanVien");
ReportDocument rptNhanVien = new ReportDocument();
//rptNhanVien.SetDatabaseLogon(myLogOnInfo.ConnectionInfo.UserID, myLogOnInfo.ConnectionInfo.Password);
rptNhanVien.Load(Server.MapPath("../RP/rptNhanVien.rpt"));
CrystalReportSource1.ReportDocument.SetDataSource(dsNhanVien);
//SetDBLogonForReport(connectionInfo,rptNhanVien);
Tables tables = rptNhanVien.Database.Tables;
foreach (CrystalDecisions.CrystalReports.Engine.Table table in tables)
{
table.ApplyLogOnInfo(myLogOnInfo);
}
CrystalReportViewer1.LogOnInfo.Add(myLogOnInfo);
CrystalReportViewer1.ReportSource = rptNhanVien;
}
More Info:
I use MSSQL Server 2008, have a Database name ERPapps and no username and Password!
Someone help me!!