Solved

sql server 2005 invalid database name error

Posted on 2012-04-04
3
334 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
  • 2
3 Comments
 
LVL 23

Accepted Solution

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

Author Comment

by:cdlciddit
Comment Utility
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
Comment Utility
That was the problem. Passing in too many variables into the ExeReader function.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

743 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now