"linq mysql database row to array" Code Answer's
You're definitely familiar with the best coding language SQL that developers use to develop their projects and they get all their queries like "linq mysql database row to array" answered properly. Developers are finding an appropriate answer about linq mysql database row to array related to the SQL coding language. By visiting this online portal developers get answers concerning SQL codes question like linq mysql database row to array. Enter your desired code related query in the search bar and get every piece of information about SQL code related question on linq mysql database row to array.
linq mysql database row to array
First make one class having similar attribute as you database table for eg:
public class Student
{
public int ID { get; set; }
public string Name { get; set; }
public DateTime DateOfBirth { get; set; }
}
after that
List<Student> student = new List<Student>();
SqlConnection conn = new SqlConnection(@"Data Source=.\SQLEXPRESS;AttachDbFilename=D:\Prac\TestAssembly\ForumsProjectCSharp\App_Data\Studetnt.mdf;Integrated Security=True;User Instance=True");
SqlCommand cmd = new SqlCommand("select * from Student", conn);
SqlDataReader dr;
try
{
conn.Open();
dr = cmd.ExecuteReader();
while (dr.Read())
{
student.Add(new Student()
{
ID = dr.GetInt32(dr.GetOrdinal("ID")),
Name = dr.GetString(dr.GetOrdinal("Name")),
DateOfBirth = dr.GetDateTime(dr.GetOrdinal("DateOfBirth"))
});
}
dr.Close();
}
catch (Exception exp)
{
throw;
}
finally
{
conn.Close();
}
Source: forums.asp.net
All those coders who are working on the SQL based application and are stuck on linq mysql database row to array can get a collection of related answers to their query. Programmers need to enter their query on linq mysql database row to array related to SQL code and they'll get their ambiguities clear immediately. On our webpage, there are tutorials about linq mysql database row to array for the programmers working on SQL code while coding their module. Coders are also allowed to rectify already present answers of linq mysql database row to array while working on the SQL language code. Developers can add up suggestions if they deem fit any other answer relating to "linq mysql database row to array". Visit this developer's friendly online web community, CodeProZone, and get your queries like linq mysql database row to array resolved professionally and stay updated to the latest SQL updates.