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
Schleid Alex
NA
361
48.2k
How to add information from database to list<t>
Jan 13 2020 10:13 AM
Good morning,
I am trying to retrieve the list of customer from the database
I have the following code
public List<Customer> ListOfCustomer()
{
SqlConnection myCon = new SqlConnection();
string strConString = ConfigurationManager.ConnectionStrings[0].ConnectionString;
myCon.ConnectionString = strConString;
SqlCommand cmd = new SqlCommand();
cmd.CommandText = "UP_SELECT_CUSTOMER_BY_STOREID";
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@StoreID", 1);
SqlDataAdapter daCustomer = new SqlDataAdapter(cmd);
DataSet dsCustomer = new DataSet();
daCustomer.Fill(dsCustomer);
List<Customer> CustList = new List<Customer>();
return CustList;
}
I can't figure out how to add the retrieve data to the list
Can someone help me please
thank you in advance
Reply
Answers (
1
)
Sharepoint restapi coding
defining connection in class file