titipop1
شنبه 05 فروردین 1396, 23:41 عصر
سلام دوستان
میخواستم گریدویو رو با کد به ویو متصل کنم
ممنون و سپاسگذار
En_MK
یک شنبه 06 فروردین 1396, 09:55 صبح
how to get data from sql database to gridview by coding ? (https://www.codeproject.com/Questions/453091/how-to-get-data-from-sql-database-to-gridview-by-c)
private void GetResults()
{
//Establishing the MySQL Connection
MySqlConnection conn = new MySqlConnection("Database=potentiality_live;Data Source=eu;User Id=ptly;Password=phat40");
string query;
MySqlCommand SqlCommand;
MySqlDataReader reader;
MySqlDataAdapter adapter = new MySqlDataAdapter();
//Open the connection to db
conn.Open();
//Generating the query to fetch the contact details
query = "SELECT id,date_time,link FROM'sdfsdfsdf'";
SqlCommand = new MySqlCommand(query, conn);
adapter.SelectCommand = new MySqlCommand(query, conn);
//execute the query
reader = SqlCommand.ExecuteReader();
//Assign the results
GridView1.DataSource = reader;
//Bind the data
GridView1.DataBind();
}
titipop1
یک شنبه 06 فروردین 1396, 21:47 عصر
متاسفانه جواب نداد
vBulletin® v4.2.5, Copyright ©2000-1403, Jelsoft Enterprises Ltd.