Hi! I used this method, but I couldn't show data in dataGridView. Who is you can help me for solve by this method.
private void JobForm_Load(object sender, EventArgs e)
{
Grid.DataSource = GetData();
}
public List<object> GetData()
{
SqlCommand cmd = con.CreateCommand();
cmd.CommandText = "select iddol, named, salaryb, salarys from tabdolj";
List<object> rc = new List<object>();
con.Open();
SqlDataReader r = cmd.ExecuteReader();
try
{
if (r != null)
{
while (r.Read())
{
rc.Add(new
{
iddol = r.GetInt32(0),
named = r.GetString(1),
salaryb = r.GetDouble(2),
salarys = r.GetDouble(3)
});
}
}
}
catch { }
con.Close();
return rc;
}