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
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
4 Replies
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Vinay SinghPosted Jun 11, 2016, 11:07 AM
Karthik ElumalaiPosted Jun 11, 2016, 7:06 AM
prasanna shahPosted Jun 10, 2016, 11:59 PM
Vinay SinghPosted Jun 10, 2016, 2:47 PM
Retrieve Connection String From Web.config In ASP.net Using C#.Net (AppSettings,ConnectionStrings)