connection problem
-
hi......... i have written code in windows application as follows app.config program.cs string conString = ConfigurationManager.ConnectionStrings["Employee.Properties.Settings.EmpdetailsConnectionString"].ConnectionString; SqlConnection con = new SqlConnection(conString); but it gives error like 1. The name ConfigurationManager Des not exist. pls help me.......
-
hi......... i have written code in windows application as follows app.config program.cs string conString = ConfigurationManager.ConnectionStrings["Employee.Properties.Settings.EmpdetailsConnectionString"].ConnectionString; SqlConnection con = new SqlConnection(conString); but it gives error like 1. The name ConfigurationManager Des not exist. pls help me.......
Now this is a properly worded question, you have givens us some code, and told us what is wrong. You still need to add the <pre> tags though. 1) You need to reference the System.Configuration dll in your project. (Right click "References", "Add Reference", select the ".Net" tab then select System.Configuration in the list and OK it. 2) Add
using System.Configuration;
to the top of the file containing your class.Dalek Dave: There are many words that some find offensive, Homosexuality, Alcoholism, Religion, Visual Basic, Manchester United, Butter.
-
Now this is a properly worded question, you have givens us some code, and told us what is wrong. You still need to add the <pre> tags though. 1) You need to reference the System.Configuration dll in your project. (Right click "References", "Add Reference", select the ".Net" tab then select System.Configuration in the list and OK it. 2) Add
using System.Configuration;
to the top of the file containing your class.Dalek Dave: There are many words that some find offensive, Homosexuality, Alcoholism, Religion, Visual Basic, Manchester United, Butter.
Thanks a lot....... this will run but their is an another error is 1.a field initializer can not reference the non static field ,method,property,"EmpDetails.form.conString" code is: string conString = ConfigurationManager.ConnectionStrings["Employee.Properties.Settings.EmpdetailsConnectionString"].ConnectionString; SqlConnection con = new SqlConnection(conString);
-
hi......... i have written code in windows application as follows app.config program.cs string conString = ConfigurationManager.ConnectionStrings["Employee.Properties.Settings.EmpdetailsConnectionString"].ConnectionString; SqlConnection con = new SqlConnection(conString); but it gives error like 1. The name ConfigurationManager Des not exist. pls help me.......
-
Thanks a lot....... this will run but their is an another error is 1.a field initializer can not reference the non static field ,method,property,"EmpDetails.form.conString" code is: string conString = ConfigurationManager.ConnectionStrings["Employee.Properties.Settings.EmpdetailsConnectionString"].ConnectionString; SqlConnection con = new SqlConnection(conString);
Hi, I suggest you move the assignments (conString and con) to the Form's Load handler. :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that.