TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
prasanna shah
NA
8
13k
ConfigurationManager.appSettings error
Jun 10 2016 1:04 PM
namespace
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web;
app1.config
<appSettings>
<add key="myconnection" value="Data Source=ps\sqlexpress; Initial Catalog=class; Integrated Security=True;"/>
</appSettings>
BllStudent.cs
public class BllStudent
{
static string connectionStr = ConfigurationManager.appSettings["myconnection"];
public DataTable getStudents()
{
SqlConnection con = new SqlConnection(connectionStr);
string sql = "select * from tbl_student";
SqlCommand cmd = new SqlCommand(sql, con);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds, "stu");
return ds.Tables["stu"];
}
public static string ConfigurationManager { get; set; }
public string System { get; set; }}
}
error:
'string' does not contain a definition for 'appSettings' and no extension method
'appSettings' accepting a first argument of type 'string' could be found (are you missing
a using directive or an assembly reference)
Hi, this is my problem. Any if got any solution for this please help.
Thank you
Reply
Answers (
4
)
Window block while opening sql connection
Get Elements By Attribute in C# using XMl document ???