db login info problem

ssfftt

Well-known member
Joined
Oct 27, 2005
Messages
163
Programming Experience
1-3
in my report, i went to "Database Expert" --> "Project Data" --> "ADO.NET Dataset" and selected the one that is filled by this query:

SELECT CYMUSER.UNAME, TEST.TNAME, RESULT.STARTTIME, RESULT.ENDTIME, RESULT.TOTALMARKS, RESULT.GRADE
FROM CYMUSER INNER JOIN
TEST ON CYMUSER.UID = TEST.UID INNER JOIN
RESULT ON CYMUSER.UID = RESULT.UID AND TEST.TID = RESULT.TID
WHERE (RESULT.RID = @RID)

at run time, when i execute the report, it keep asks for db login information, that is DB Name, Server Name, Pw, User Name. I use MS SQL, i didnt set up any password and user id at all. Why these non-existing info is asked, can anyone help me to get around it plz?
 
btw, if i go "Database Expert" --> "OLE DB ADO" --> and select "MICROSOFT OLE DB Provider for SQL Server" ---> and tick "integrated security" to get dataset from the dabaset directly instead of the way mentioned above, at runtime, the report works just fine, wont ask for any DB login info. However, if i did this way, i need help on how to get the above query work and how to get the parameter "@RID" and pass it to the report fields. please help
 
I think I have figured this out for you. I was having the exact same problem all morning, so I decided to look at my old code from a project a few months back, and realised I hadn't set the datasource of the report in my code.

What code are you using? You have only mentioned the query above.

See if you can figure out what you need from my code; it is for when a button is pressed on my menu, and passes a parameter across to show the specified record.

VB.NET:
[SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] rpt [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=2] CrystalReport1
[/SIZE][SIZE=2]ParamValue = lblDWRNo.Text
rpt.SetDataSource(DsSearchDWR1) [COLOR=green]'[/COLOR][/SIZE][COLOR=green] THIS IS WHAT I WAS MISSING[/COLOR]
[SIZE=2]rpt.SetParameterValue("DWRNumber", ParamValue)
crviewer.ReportSource = rpt

Hope that's of some help to you,

Regards,
Luke
[/SIZE]
 
thx V-B New-B, it partially resolved my problem, however, i have 2 select clauses, i.e. i need 2 datasets, do you know how can i realize this?
 
I have created a seperate dataSet for my reports. I don't know if this is the best thing but it certainly does it's job. Basically on my form with the crViewer, I create every dataAdapter needed and generate a new dataSet called dsReports. I then bind everything to this to do with reporting.

Luke
 
Yep, it actually has a copy of all of the dataAdapters I use in my app, one for each table.
I've done it this way because when a new record is added on my form, it is saved to the database. Then when a report is run, I've set it to use the dsReports. the dataAdapters that fill this obviously include the new records.
 
Back
Top