Solved

sql server 2005 invalid database name error

Posted on 2012-04-04
3
347 Views
Last Modified: 2012-04-09
Hello. I have a page that keeps giving me an error that says "invalid database name". I don't know why I get this error. I know my connection string in my web.config is correct b'c the referring page uses the same web.config file to access the same database and the same table.  I have a file with an online form. When submitted the information from the form is dumped into my sql database and then the user is sent to another page which pulls that information that is just dumped into a printable format.  My problem is that when the print page is called I get an error that says "invalid database name". Here is the code that actually pulls the information from the database:
Protected Sub Page_Load(sender As Object, e As System.EventArgs)
        If Not Page.IsPostBack Then
            Master.Section = "forms"
            'Binds listview to database
            lv.DataSource = ExeReader("AAC", "SELECT * FROM [Interact_Plan] ORDER BY                        
                                                         firstName ASC")
            lv.DataBind()
        End If
    End Sub

And here is my connection string in my web.config
<ConnectionString>Data Source=MYDB1;Initial Catalog=AAC;User ID=sa;Password=*****</ConnectionString>

I don't understand how it can work for one page and not the other.
0
Comment
Question by:cdlciddit
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 23

Accepted Solution

by:
wdosanjos earned 500 total points
ID: 37807216
I suspect the problem is on the ExeReader code.  Can you post it?
0
 

Author Comment

by:cdlciddit
ID: 37823565
Hello. Yes. That was it. That ExeReader only took one variable and I was passing in two.  It is funny how that would give me a database error. Thanks for your help
0
 

Author Closing Comment

by:cdlciddit
ID: 37823572
That was the problem. Passing in too many variables into the ExeReader function.
0

Featured Post

Turn Insights Into Action

You’ve already invested in ITSM tools, chat applications, automation utilities, and more. Fortify these solutions with intelligent communications so you can drive business processes forward.

With xMatters, you'll never miss a beat.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question