我不能夠做的INSERT,UPDATE,DELETE和我在的WinForms ListView的CLEAR operatopns顯示的ListView錯誤
這裏是我的代碼:
private void Form1_Load(object sender, EventArgs e)
{
ShowData();
}
private void ShowData()
{
SqlConnection con = new SqlConnection("User id=sa;[email protected];database=arvind;server=ASHOK-PC");
con.Open();
SqlCommand cmd = new SqlCommand("select * from Login_1",con);
DataTable dt = new DataTable();
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(dt);
listView1.DataContext = dt.DefaultView;
}
我在DataContext的有誤差
System.Windows.Forms.ListView does not contain a definition for datacontext and no extension method accepting a first argument of type System.Windows.Forms.Listview could be found.
哦,我很抱歉,因爲它..但我正在嘗試代碼,並得到了一些如何激怒..所以..hope不要介意plz .. – user3278187