Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 362
  • Last Modified:

sql server 2005 invalid database name error

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
cdlciddit
Asked:
cdlciddit
  • 2
1 Solution
 
wdosanjosCommented:
I suspect the problem is on the ExeReader code.  Can you post it?
0
 
cdlcidditAuthor Commented:
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
 
cdlcidditAuthor Commented:
That was the problem. Passing in too many variables into the ExeReader function.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now