I am trying to connect my local SQL database to ac# forms application but it won't read data from the file.
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
string connectionString = Form1.Properties.Settings.Default.ConnectionString;
}
}
Normally your Settings
class should be under <DefaultProjectNameSpace>.Properties.Settings.Default.ConnectionString
where <DefaultProjectNameSpace>
is the namespace of your project/application.
If it is not there try to locate it from your project under the Properties folder.
<connectionStrings>
<add name="MediaMantradb" connectionString="data source=.;database=MediaMantradb; integrated security=true; trusted_connection=true" providerName="System.Data.SqlClient"/>
</connectionStrings>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.