|
-
May 15th, 2008, 10:43 AM
#1
Thread Starter
Member
connection string not initialized
(VS 2008 .net 3.5) I'm really confused right now. Someone else created a website that I've been working on. We open the project solution when we work on it because we're using SourceGear Vault so everyone can work on it at the same time. We have different classes we're using and there's a global.asax. When I work on this program, it points to a local location on my computer, yet it's still connected through the network to know who has what checked out and what i can or cannot work on. When I run the program locally, everything works perfectly fine. When I put the application on the web server so I can view the program on our intranet site, I keep getting the connection string has not been initialized error. What's the difference between running it on my machine locally and running it on the web server?
Here's the global file that gets the connection
Code:
Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
' Code that runs on application startup
Dim JMconnString As String = ConfigurationManager.ConnectionStrings("JMConnectionString").ConnectionString
Dim M2MconnString As String = ConfigurationManager.ConnectionStrings("M2MConnectionString").ConnectionString
DBObj = New DBTools(JMconnString, M2MconnString, "c:")
Application("DBTools") = DBObj
Dim configfile As String = ConfigurationManager.AppSettings("OptionFileLoc")
configfile = Server.MapPath("ConFig/")
configfile = configfile & "ProgramInfo.xml"
ConfigurationManager.AppSettings("OptionFileLoc") = configfile
End Sub
This is the code that's running
Code:
Dim dt As DataTable = QuikShipProduct.GetQSProductTypes
this calls the class that runs this:
Public Shared Function GetQSProductTypes()
Return DBTools.CreateDT("select * from tblQSProductTypes order by ProdTypeID", DBLayer.DBTools.DB.DW)
End Function
Let me know if any code or other information is needed.
-
May 15th, 2008, 11:48 AM
#2
Re: connection string not initialized
Code:
ConfigurationManager.ConnectionStrings
This I believe is reading the Web.Config file for the connection string (may be another app.config, not sure how you're app is setup). Check the connection string names and declarations in the ConnectionStrings portion of your config file (if this exists) match on the server and your local machine.
There's a greate freeware file comparison tool called ExamDiff which you can lookup from a searchengine to save time...
-
May 15th, 2008, 11:52 AM
#3
Thread Starter
Member
Re: connection string not initialized
What do you mean by match them on the local and server machines? How would I do that?
You are right, in the web.config file I have these connection strings:
HTML Code:
<connectionStrings>
<add name="JMConnectionString" connectionString="Data Source=DATA2;Initial Catalog=JobInfo;User ID=123WEB;Password=213bew" providerName="System.Data.SqlClient"/>
<add name="M2MConnectionString" connectionString="Data Source=DATA2;Initial Catalog=DATA01;User ID=123WEB;Password=213bew" providerName="System.Data.SqlClient"/>
</connectionStrings>
-
May 15th, 2008, 11:59 AM
#4
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|