Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Where to store my connection string?
Message
De
18/05/2001 13:25:55
 
 
À
18/05/2001 12:01:49
Fausto Garcia
Independent Developer
Lima, Pérou
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
00508784
Message ID:
00508858
Vues:
21
This message has been marked as a message which has helped to the initial question of the thread.
>I am writing a small site and most of its pages (.asp) perform data access to build their content dinamically, retrieving data from a specific data source. I am connecting to a VFP database so I don't need to specify a user ID and thus the connection string remains identical for everyone.
>
>Where do you think is a good place to store the connection string? I have been thinking about an application variable. Any suggestions?


You could store in an application variable in global.asa:
Sub Appplication_OnStart
  ' project data connection
  Application("MyConnectionString") = "DSN=MyDSN;UID=sa;PWD=MyPwd;Database=MyDB"
  '(or you can do the same for OleDB instead)
End Sub
Then in an ASP page:
Set oConn = Server.CreateObject("ADODB.Connection")
oConn.ConnectionString = Application("MyConnectionString")
oConn.Open
This way the connection string is not hardcoded in all you ASP pages but read from global.asa as needed.


Alex Feldstein, MCP, Microsoft MVP
VFP Tips: English - Spanish
Website - Blog - Photo Gallery


"Once again, we come to the Holiday Season, a deeply religious time that each of us observes, in his own way, by going to the mall of his choice." -- Dave Barry
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform