my connection string cannot login to my database.This is my connectionString
<add name="ProductEntities" connectionString="Data Source=**.**.***.**\MSSQLSERVER2017;Database=product1_;User Id=product;Password=*****;" providerName="System.Data.EntityClient" />
And these connectionStrings are that i tried in web.config
connectionString="Data Source=**.***.**.**\MSSQLSERVER2017;Network Library=DBMSSOCN;Initial Catalog=product1_;User ID=product;Password=*****;"
connectionString="data source=**.***.**.**\MSSQLSERVER2017;initial catalog=product1_;user id=product;password=*****;integrated security=True;MultipleActiveResultSets=True"
providerName="System.Data.EntityClient" />
and the other error is database cannot open.How can i fix this ?
Related
First, I had similar problem Keyword not supported for "metadata". So, I wrote data source instead of metadata. After that, I tried to create Controller for ASP.NET MVC and that show me Keyword not supported for "provider". I read the some case for SQL SERVER connection, but I didn't found for Oracle connection.
Here is my connectionStrings in web.config file.
<connectionStrings>
<add name="DefaultConnection" connectionString="Data Source=(LocalDb)\v11.0;Initial Catalog=aspnet-MVC-20170801212521;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnet-MVC-20170801212521.mdf" providerName="System.Data.SqlClient" />
<add name="EntitiesLL" connectionString="Data Source=res://*/Models.Model1.csdl|res://*/Models.Model1.ssdl|res://*/Models.Model1.msl;provider=Oracle.ManagedDataAccess.Client;data source=****:1111/xe;password=******;user id=******;" providerName="System.Data.SqlClient" />
</connectionStrings>
Thank you.
The problem is this
providerName="System.Data.SqlClient"
Something tells me it should be OracleClient.
According to official documentation this should read:
<connectionStrings>
<add name="DefaultConnection" connectionString="Data Source=(LocalDb)\v11.0;Initial Catalog=aspnet-MVC-20170801212521;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnet-MVC-20170801212521.mdf" providerName="System.Data.SqlClient" />
<add name="EntitiesLL" connectionString="Data Source=res://*/Models.Model1.csdl|res://*/Models.Model1.ssdl|res://*/Models.Model1.msl;data source=****:1111/xe;password=******;user id=******;" providerName="Oracle.ManagedDataAccess.Client" />
</connectionStrings>
I have app.config like this:
<connectionStrings>
<add name="MyDB" connectionString="Data Source=(localdb)\ProjectsV12;Initial Catalog=MrBoy;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False" />
</connectionStrings>
In my DbContext class, it works fine if I copy-paste the connection-string e.g.
: base("Data Source=(localdb)\ProjectsV12;Initial Catalog=MrBoy;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False")
But if I specify
:base("name=MyDB")
I get an error from my application and from the Package manager console:
"The connection string 'MyDB' in the application's configuration file
does not contain the required providerName attribute."
Why is a valid connection-string not accepted? Is there a workaround other than passing the connection-string manually into my constructor?
Do this
<add name="MyDB" connectionString="Data Source=(localdb)\ProjectsV12;Initial Catalog=MrBoy;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False" providerName="System.Data.SqlClient" />
Connectionstrings require a provider type. Setting it as entity context != defining the connection string. The type is assumed when you are setting context.
On my live box I am getting an error that the connection string is malformerd but when i try it on my dev box it is fine.
<add name="aperturenetEntities" connectionString="metadata=res://*/ApertureModel.csdl|res://*/ApertureModel.ssdl|res://*/ApertureModel.msl;provider=System.Data.SqlClient;provider connection string="data source=APR-AZ-DB01;initial catalog=aperturenet;user id=aperturenet;password=dw13£sowwoq;multipleactiveresultsets=True;application name=EntityFramework"" providerName="System.Data.EntityClient" />
<add name="aperturenetSql" connectionString="Data Source=APR-AZ-DB01;database=aperturenet;User ID=username;Password=password" providerName="System.Data.SqlClient" />
They are both .net 4.5 boxes with no difference in sql version of the driver but yet i get malformed elements when running the application any idea?.
<add name="aperturenetEntities" connectionString="metadata=res://*/ApertureModel.csdl|res://*/ApertureModel.ssdl|res://*/ApertureModel.msl;provider=System.Data.SqlClient;provider connection string="data source=APR-AZ-DB01;initial catalog=aperturenet;user id=aperturenet;password=dw13£sowwoq;multipleactiveresultsets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
try this,
i have changed Application Name to App in your connection string.
i have myself tried a lot but i couldn't find out what is the problem of my below connection string. i have put both my webhost connection string and winform connection string help please?
<connectionStrings> <add name="ReGdbEntities" connectionString="metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;
provider=System.Data.SqlClient;
provider connection string="data source=.\SQLEXPRESS;
initial catalog=ReGdb;
integrated security=True;
MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" /> </connectionStrings>
and here is my webhostdatabase connectionstring
Data Source=SQL5000322.Smarterasp.net;
Initial Catalog=DB_9BDB7789_ReGdb;
User Id=DB_9BDB7789_ReGdb_admin;
Password=happy;
hey bro you can modify your connection string this way and it must work. just copy and replace it with your connection string
<connectionStrings>
<add name="ReGdbEntities" connectionString="metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;
provider=System.Data.SqlClient;
provider connection tring=quot;
datasource=SQL5000322.Smarterasp.net;
initial catalog=DB_9BDB7789_ReGdb;
User Id=DB_9BDB7789_ReGdb_admin;
Password=happy;
MultipleActiveResultSets=True;
App=EntityFramework""
providerName="System.Data.EntityClient" />
</connectionStrings>
here you go bro it must work
Pay attention to nested quotes:
provider connection string="data source=...
I have a connection string like this
<add name="rackleyConnectionString1" connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\rackley.mdb;Persist Security Info=True;Jet OLEDB:Database Password=Password"
providerName="System.Data.OleDb" />
Now I copied that mdb file into my sql server. Now I changed connection string to this
<add name="rackleyConnectionString" connectionString="Data Source=ODO-SRV004;Initial Catalog=rackley;Integrated Security=True"
providerName="System.Data.SqlClient" />
when I run the program it shows error: "OLE DB provider was not specified in the connection string. An example would be Provider=SQLOLEDB"
Please help to solve this issue.
I hope you are opening sql connection as below
Dim cn As SqlConnection= New SqlConnection(sConn)
and not
Dim cn As OleDbConnection = New OleDbConnection(sConn)
I think You misplaced \ instead of /
<add name="rackleyConnectionString1" connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:/rackley.mdb;Persist Security Info=True;Jet OLEDB:Database Password=Password"
providerName="System.Data.OleDb" />
I always used /. please try this
<add name="rackleyConnectionString" connectionString="Provider=SQLOLED;Data Source=ODO-SRV004;Initial Catalog=rackley;Integrated Security=SSPI" />
Try this connection string hope this helps.