mvaculisteanu mvaculisteanu - 4 months ago 25
C# Question

crystal reports asking for database password when i have not set any

Crystal reports is asking for database user and password when i try to view a report but i have not set any for my local *.sdf file.
My conection string only contains the dataset parameter and the passsword if i chose one but no user.

Answer

you can use this code :

ReportDocument1.DataSourceConnections.Item(0).SetConnection(strLocationOfDatabase, "", "UserName", "Password")

or if you dont have username and password :

ReportDocument1.DataSourceConnections.Item(0).SetConnection(strLocationOfDatabase, "", False)