情况是这样的:
在用DATAGRID的时候,窗体能显示表的列名,但不能显示里面 的数据
在用DATAGRID的时候,窗体能显示表的列名,但不能显示里面 的数据
解决方案 »
- VS2008开发的网站IIS要求有.vb文件?ASPX+VB.NET
- 先这样学习SQL可以吗?大家给点意见!!!
- 关于DATALIST中模板列
- 页面10分钟刷新一次?怎么实现?
- 求教:高人:datagrid 的 超级连接列 ,弹出的页面怎么不能请求 session 值呢。
- 请用过此oa系统的大侠帮一下忙,谢谢!
- 偶想学.net
- 这个问题真奇怪,连接数据库时老是出现“Microsoft Jet 数据库引擎打不开文件'D:\Samples\Data\Nwind.mdb'。 它已经被别的用户以独占方式
- 如何在C#程序中控制浏览器窗口的大小
- 请问在页面里,用ASP.NET怎么画图,并生成图片啊?
- ♀如何将Web窗体进行扩展后,然后在工程中使用呢?♂Eager
- 问题来了,哪位能帮解决?(关于连接的)
2.只设置了Head Text,没有设置Data Field
<HeaderStyle HorizontalAlign="Center" Width="10%"></HeaderStyle>
<ItemStyle Wrap="False" HorizontalAlign="right" Width="10%"></ItemStyle>
</asp:BoundColumn>DataField 的值要与数据库字段值一致
运行的时候页面一片空白
我的意思是只通过数据控件来实现
小弟在这里说SORRY了
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If Not IsPostBack Then
Me.SqlDataAdapter1.Fill(DataSet11)
Me.DataGrid1.DataBind()
End If
End Sub
还有,是不是你的 data source没有绑定?
最好还是把源码贴出来
我是用C#的
sqlDataAdapter1.Fill(dataSet41,"FJ_FileInfo");
this.DataBind();
{
this.sqlConnection1 = new System.Data.SqlClient.SqlConnection();
this.sqlInsertCommand1 = new System.Data.SqlClient.SqlCommand();
this.sqlUpdateCommand1 = new System.Data.SqlClient.SqlCommand();
this.sqlDeleteCommand1 = new System.Data.SqlClient.SqlCommand();
this.sqlDataAdapter1 = new System.Data.SqlClient.SqlDataAdapter();
this.sqlSelectCommand1 = new System.Data.SqlClient.SqlCommand();
this.dataSet41 = new WebApplication1.DataSet4();
((System.ComponentModel.ISupportInitialize)(this.dataSet41)).BeginInit();
this.DataGrid1.Unload += new System.EventHandler(this.DataGrid1_Unload);
this.DataGrid1.Init += new System.EventHandler(this.DataGrid1_Unload);
this.DataGrid1.Disposed += new System.EventHandler(this.DataGrid1_Unload);
this.DataGrid1.PreRender += new System.EventHandler(this.DataGrid1_Unload);
this.DataGrid1.DataBinding += new System.EventHandler(this.Page_Load);
this.DataGrid1.Load += new System.EventHandler(this.DataGrid1_Unload);
this.DataGrid1.SelectedIndexChanged += new System.EventHandler(this.DataGrid1_Unload);
//
// sqlConnection1
//
this.sqlConnection1.ConnectionString = "initial catalog=EHR;packet size=4096;integrated security=SSPI;data source=C184;pe" +
"rsist security info=False;connect timeout=30;workstation id=C184";
this.sqlConnection1.InfoMessage += new System.Data.SqlClient.SqlInfoMessageEventHandler(this.sqlConnection1_InfoMessage);
//
this.sqlInsertCommand1.CommandText = @"INSERT INTO FJ_FileInfo(Typeid, title, Authorizer, valid, EnactDate, EnactOrg, ActDate, InvalidDate, ContentType, DocNO, keywords, text, Notes, ClassNo) VALUES (@Typeid, @title, @Authorizer, @valid, @EnactDate, @EnactOrg, @ActDate, @InvalidDate, @ContentType, @DocNO, @keywords, @text, @Notes, @ClassNo); SELECT id, Typeid, title, Authorizer, valid, EnactDate, EnactOrg, ActDate, InvalidDate, ContentType, DocNO, keywords, text, Notes, ClassNo FROM FJ_FileInfo WHERE (id = @@IDENTITY)";
this.sqlInsertCommand1.Connection = this.sqlConnection1;
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Typeid", System.Data.SqlDbType.VarChar, 15, "Typeid"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@title", System.Data.SqlDbType.VarChar, 400, "title"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Authorizer", System.Data.SqlDbType.VarChar, 10, "Authorizer"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@valid", System.Data.SqlDbType.Bit, 1, "valid"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@EnactDate", System.Data.SqlDbType.VarChar, 10, "EnactDate"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@EnactOrg", System.Data.SqlDbType.VarChar, 400, "EnactOrg"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@ActDate", System.Data.SqlDbType.VarChar, 10, "ActDate"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@InvalidDate", System.Data.SqlDbType.VarChar, 10, "InvalidDate"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@ContentType", System.Data.SqlDbType.VarChar, 200, "ContentType"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@DocNO", System.Data.SqlDbType.VarChar, 200, "DocNO"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@keywords", System.Data.SqlDbType.VarChar, 2147483647, "keywords"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@text", System.Data.SqlDbType.NVarChar, 1073741823, "text"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Notes", System.Data.SqlDbType.VarChar, 2147483647, "Notes"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@ClassNo", System.Data.SqlDbType.VarChar, 40, "ClassNo"));