private void monthCalendar1_DateChanged(object sender, DateRangeEventArgs e)
{
string strcon = "Data Source=.\\SQLEXPRESS;AttachDbFilename=C:\\Users\\Fellipe\\documents\\visual studio 2010\\Projects\\WindowsFormsApplication2\\WindowsFormsApplication2\\PUBS.MDF;Integrated Security=True;Connect Timeout=30;MultipleActiveResultSets=True;User Instance=True";
SqlConnection conexao = new SqlConnection(strcon);
conexao.Open();
SqlDataAdapter Buscar = new SqlDataAdapter("SELECT ROTA, DOCA FROM Planilha4 WHERE D2 =" + monthCalendar1.SelectionStart.ToString("dd/MM/yyyy"), conexao);
DataTable dt = new DataTable();
Buscar.Fill(dt);
SqlDataAdapter sda = new SqlDataAdapter();
BindingSource bSource = new BindingSource();
bSource.DataSource = dt;
dataGridView1.DataSource = bSource;
sda.Update(dt);
}
错误被抛出,Buscar.Fill(dt);
我想消除这个错误。我正在等待答复。谢谢