Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing Database Name at runtime

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
0
0
Hi All<br><br>I want to change the database name at runtime while opening report. I am opening the report by redirecting it from ASP and passing the User Id and password along with it and if their are any prompt values that too I am supplying. But my problem is that How will I specify the database from where it should pick the data. This problem arises because in my apllication I have to open database depending upon the user Loged in. If it is User 1 then Database 1 will open and if it User 2 then Databse 2 should open up. ASP forms works ok but reports show the data as per the DSN name/the database name specified in report itself.<br>&nbsp;<br>Pls suggest a way for this?<br><br>Thanks<br>Hemant
 
When you design the report use a Data definition file, this is a template of the data that you want to use in the report and is not dependent on the the database location, you could take the data from any type of db (access, Oracle, SQL). TO add a DDF follow the folowing in the designer window (CR6)<br><br>To create a DDF for a report, In the top left corner of the designer window there is the Main Report tab.<br><br>· On the Main Report tab right click the Database Fields icon.<br><br>· Click the Add Database to Report option.<br><br>· Click the SQL Table… button.<br><br>· In the Server Type listbox choose the Active Data (Field Definitions Only) option and click OK<br><br>· The Select Data Source Window Appear<br><br>· The Data Definition box should be enabled click the New button.<br><br>· The Database Definition Tool window appears.<br><br>Then in the form you use as the viewer (or in the Designer) open a recordet and use your connection string from the ASP to open the recordset and the data is passed into your report. Just be very careful that the you have the fields in your recordset must be in the same order as in the DDF. <br><br>There is an Ok help section on this in the CR help files on DDF&nbsp;&nbsp;its worth reading<br><br>I hope this helps you get farther to completion.<br>Good luck<br>Will <br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top