PDA

View Full Version : مشکل در استفاده از ConnectionStrings



h.alizadeh
سه شنبه 17 دی 1387, 16:08 عصر
سلام،

من میخوام از کانکشن م در app.config توی فرم هام استفاده کنم .

این متن کامل فایل app.config :





<?xml version="1.0" encoding="utf-8" ?>


<configuration>


<configSections>


</configSections>


<connectionStrings>


<add name="HomaMemory.Properties.Settings.noteConString" connectionString="Data Source=HOMA-A22CF7452A;Initial Catalog=note;Integrated Security=True"


providerName="System.Data.SqlClient" />


</connectionStrings>
</configuration>



اینجوری من توی فرم موردنظرم نوشتم:






SqlConnection objCon = new SqlConnection(ConfigurationManager.ConnectionStrin gs["noteConString"].ConnectionString);



روی ConfigurationManager اررور میده میگه
Ten name " ConfigurationManager " does not exsit in this context


البته من وقتی می خوام ConfigurationManager رو بنویسم توی منوی بازشو وجود نداره.

اینم نیم اسپیس های من:






using System;


using System.Collections.Generic;


using System.ComponentModel;


using System.Data;


using System.Drawing;


using System.Text;


using System.Windows.Forms;


using System.Data.SqlClient;


using System.Configuration;

h.alizadeh
جمعه 20 دی 1387, 22:36 عصر
میگم کسی متوجه ایراد کار من نشد؟!
http://qsmile.com/qsimages/42.gif