Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error using named connection and SQL Express #390

Open
GusBeare opened this issue May 20, 2016 · 4 comments
Open

error using named connection and SQL Express #390

GusBeare opened this issue May 20, 2016 · 4 comments

Comments

@GusBeare
Copy link

I am using SImple.Data locally and have this code:

var db = Database.OpenNamedConnection("q2_admin");
//var db = Database.Open();

It works fine in my dev environment where I am using a developer version of SQL server 2012.

However when my colleague runs the code on his box with SQL Express 2012 he gets this error:

[Error] Specified argument was out of the range of valid values.
Parameter name: connectionName

If I switch to using the default connection it works fine.

Is SQL Express supported? Or is this a bug?

@WayneHiller
Copy link

I use SQL Server 2012 Enterprise, Standard and Express no differences in connecting. Make sure a connection section exists in the config with that exact name on all the computers using your code.

@GusBeare
Copy link
Author

Thanks Wayne. My colleague has the same code base and web.config as myself. The connection strings are in his web.config. I am wondering if there is an issue with underscores in the connection string name? I will check out this theory and report back.

@GusBeare
Copy link
Author

Yes, I was correct. Having an underscore in the connection name causes the error in SQL Express 2012. Removing the underscore fixed the problem.
Is this a Simple.Data issue or a SQL server Express
one?

@WayneHiller
Copy link

Interesting.I have never tried using a leading underscore in the connection name. I don't see how it could be Simple.data as ut just uses the SqlConnection object.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants