سؤال

I already display data to a DataGridView in my form with these codes, now I want to display that in a report viewer. How can I do this ?

//Fill DataGridView
try
{
    MyDB db = new MyDB();//my connection string
    string sql = "SELECT * FROM innoviceitem WHERE id='{0}'";
    sql = string.Format(sql, id);//id is a public string that its value has been set
    SqlDataAdapter sda = new SqlDataAdapter(sql, db.MyConn);
    DataSet ds = new DataSet();
    BindingSource bs = new BindingSource();
    sda.Fill(ds);
    bs.DataSource = ds.Tables[0].DefaultView;
    datagridview1.DataSource = bs;
}
catch (Exception err) { MessageBox.Show(err.Message); }
هل كانت مفيدة؟
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top