Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Changing odbc instance
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Crystal Reports
Divers
Thread ID:
01017245
Message ID:
01017306
Vues:
20
Federico,
We have a similar situation where the crystal report needs to run against either the production database or the test database. Here's an example of how to change all of the connection settings for the crystal report. Our reports use OLEDB provider but you should be able to do something similar with an ODBC connection. You may need to have seperate DSN's for each server however.
*	Loop through each table in the report
FOR lnCounter = 1 TO loReport.Database.Tables.Count
	WITH loReport.Database.Tables(lnCounter).ConnectionProperties
		*	Save the current table name
		lcLocation = loReport.Database.Tables(lnCounter).Location
		
		*	Clear the current connection properties
		.DeleteAll()
		
		*	Set the connection properties to the correct server
		.Add('Provider','SQLOLEDB')
		.Add('Data Source',lcServerName)
		.Add('Initial Catalog',lcDatabase)
		.Add('Integrated Security',0)			
		.Add('Password',lcPassword)			
		.Add('User ID',lcUserId)		
		
		*	Reset the table location
		loReport.Database.Tables(lnCounter).Location = lcLocation
	ENDWITH
ENDFOR
Hope this helps,
Kurt
>I have 8 directories (dir1 dir2, dir3....dir8) with file1, file2, file3 in each one. In other directory called "cansolid" I have the odbc instance of each directory (pointing to..). I do this because i have 8 accountings (is that the name????) for the same number of entities. Additionally, I have a directory i wich i have ther reports. (here comes the point) I made a report wich uses 4 subreports all of then using the odbc instance that points to the dir2 works like a charm. I made an interface using the crystal report control to print the report, it works fine, but when i want to programatically change the odbc instance to use the files in dir6 it prints dir2 information.
>How do I change programatically an instance of odbc as if I were "setting the location" of the files using the crystal report program, even more is there a way to expand automatically the changes to the sub report?
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform