Click here to Skip to main content
15,901,373 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
When running my project in visual basic I get the error message during debugging:
Argument eception was unhandled by user code

The error refers to this code:
Sql conn = new SqlConnection(ConfigurationManager.ConnectionStrings["RegistrationConnectionString"].ConnectionString);

Please help
Posted
Comments
Sascha Lefèvre 4-May-15 16:08pm    
Look at the exception message, it should be more specific
Joshua Holland 4-May-15 19:53pm    
keyword not supported: 'provider'
Sascha Lefèvre 5-May-15 2:35am    
As Tadit Dash already commented, your ConnectionString isn't correct. If you can't fix it with this info, please post the entry from your app.config/web.config file.
Samira Radwan 4-May-15 16:50pm    
please provide more data to be able to help you. the error could be in your Sqlcommand or parameters.
Joshua Holland 4-May-15 18:53pm    
keyword not supported: 'provider'

Your connection string is not correctly formatted for your database. Take a look at the following URL to find specific examples for your database.

https://www.connectionstrings.com/

Also, in the future, you should be wrapping a try/catch around your connection code and any other database access. Then, when an error occurs you should display the error message to the user or log it.

-Matt-
 
Share this answer
 
In your web.config do you use the word "provider" in your connection string?
you should use something like this if you use SqlConnection:
C#
<add name="DBnmae" connectionstring="your connection string" providername="System.Data.sqlClient"></add>

You should use "providerName" not "Provider".
Hope this helps
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900