且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

“System.Windows.Forms.DataGrid ...

更新时间:2023-12-06 14:39:28

仅使用该代码片段且没有错误消息,它几乎不可能分辨,但很可能你使用的是错误的DataAdapter。

尝试:

With just that code fragment and no error message, it's pretty much impossible to tell, but it's likely that you are using the wrong DataAdapter.
Try:
SqlDataAdapter da = new SqlDataAdapter(q,constr);
DataTable dt = new DataTable();
da.Fill(dt);
GridView1.DataSource = dt;
GridView1.DataBind();

如果这不起作用,我们需要错误信息及其抱怨的行。

And if that doesn't work, we would need the error message, and the line it is complaining about.