You can just pull the whole project into your solution and then you don't need to add anything to your App_Code... just pull in a reference to the project!
OK, I think I have the dll's in the right place and working but I couldn't follow your instructions. I am working with a solution that just contains the web site I am developing, no projects, so I think your instruction don't work?
OK, thanks, done all of that but I now get a compilation error in my code wherever I use the SessionConnectionStringsExpressionBuilder:
Error 10 Name 'SessionConnectionStringsExpressionBuilder' is not declared. C:\Documents and Settings\Cliff\My Documents\My Webs\DataLabDotNet\Default.aspx 98 17 C:\...\DataLabDotNet\
You need to build your ConnectionStringSetting as per your original code, and then pass that in... e.g.
Dim objClientConnection As New ConnectionStringSettings
objClientConnection.Name = "ClientDBConnection"
objClientConnection.ConnectionString = "xxxxxxxxx" ' substitute whatever you would have entered into Session("ClientDBConnectionString")
objClientConnection.ProviderName = "System.Data.SqlClient"
SessionExpressionBuilders.SessionConnectionStringsExpressionBuilder.AddSettings(objClientConnection)
Alternatively, you could do this...
SessionExpressionBuilders.SessionConnectionStringsExpressionBuilder.AddSettings("ClientDBConnection", "xxxxxxxxx", "System.Data.SqlClient")
' substitute xxxxxx for whatever you would have entered into Session("ClientDBConnectionString")
' or even
SessionExpressionBuilders.SessionConnectionStringsExpressionBuilder.AddSettings("ClientDBConnection", "xxxxxxxxx")
' as I believe the SQL client is the default!
CliffMitchel...
Member
147 Points
47 Posts
Re: Dynamic connection strings
Feb 13, 2007 08:16 AM|LINK
Hi James,
Can you please confirm that I now need all of these files in my App_Code folder:
SessionAppSettingsExpressionBuilder.vb
SessionConnectionStringsExpressionBuilder.vb
SessionHelper.vb
SR.vb
Thanks,
Cliff
James_2JS
Participant
1526 Points
335 Posts
Re: Dynamic connection strings
Feb 13, 2007 08:36 AM|LINK
CliffMitchel...
Member
147 Points
47 Posts
Re: Dynamic connection strings
Feb 13, 2007 09:02 AM|LINK
Sorry James, not sure how to do this - can you explain. I also need to be clear about what files to copy to the production server.
Thanks,
Cliff
James_2JS
Participant
1526 Points
335 Posts
Re: Dynamic connection strings
Feb 13, 2007 09:58 AM|LINK
OK...
The key file here is the .DLL. This has all the code for the SessionExpressionBuilders in it compiled and ready to go.
When you deploy to production, you just need to deploy that .DLL in the Bin folder!
CliffMitchel...
Member
147 Points
47 Posts
Re: Dynamic connection strings
Feb 13, 2007 12:29 PM|LINK
OK, I think I have the dll's in the right place and working but I couldn't follow your instructions. I am working with a solution that just contains the web site I am developing, no projects, so I think your instruction don't work?
Cliff
James_2JS
Participant
1526 Points
335 Posts
Re: Dynamic connection strings
Feb 13, 2007 02:00 PM|LINK
OK...
Then proceed as before!
CliffMitchel...
Member
147 Points
47 Posts
Re: Dynamic connection strings
Feb 13, 2007 02:30 PM|LINK
OK, thanks, done all of that but I now get a compilation error in my code wherever I use the SessionConnectionStringsExpressionBuilder:
Error 10 Name 'SessionConnectionStringsExpressionBuilder' is not declared. C:\Documents and Settings\Cliff\My Documents\My Webs\DataLabDotNet\Default.aspx 98 17 C:\...\DataLabDotNet\
Any ideas?
Thanks,
Cliff
CliffMitchel...
Member
147 Points
47 Posts
Re: Dynamic connection strings
Feb 13, 2007 02:46 PM|LINK
OK, I think I got it!
The calls now need to be of the form:
SessionExpressionBuilders.SessionConnectionStringsExpressionBuilder.AddSettings(
"WebTool1ConnectionString", Session("ClientDBConnectionString")) Am I right?Thanks,
Cliff
James_2JS
Participant
1526 Points
335 Posts
Re: Dynamic connection strings
Feb 13, 2007 02:59 PM|LINK
Almost!!!
You need to build your ConnectionStringSetting as per your original code, and then pass that in... e.g.
Dim objClientConnection As New ConnectionStringSettings objClientConnection.Name = "ClientDBConnection" objClientConnection.ConnectionString = "xxxxxxxxx" ' substitute whatever you would have entered into Session("ClientDBConnectionString") objClientConnection.ProviderName = "System.Data.SqlClient" SessionExpressionBuilders.SessionConnectionStringsExpressionBuilder.AddSettings(objClientConnection)Alternatively, you could do this...
CliffMitchel...
Member
147 Points
47 Posts
Re: Dynamic connection strings
Feb 13, 2007 03:27 PM|LINK
OK, thanks.
My code:
SessionExpressionBuilders.SessionConnectionStringsExpressionBuilder.AddSettings(
"WebTool1ConnectionString", Session("ClientDBConnectionString"), "System.Data.SqlClient")works fine now because I have the connection string held in the session variable.
I promise I will leave you in peace soon - you have been amazingly patient!
Cliff