我想这样!再dbgrid中某项设置成超连接 也就是说,我怎么修改dbgrid中的内容 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 在itemDataBound事件中,可以改写dataGrid内容e.item.Cell[i].Controls[j].... 给你一段代码SqlConnection myConnection = new SqlConnection( ConfigurationSettings.AppSettings["connstr"] ); SqlDataAdapter myCommand = new SqlDataAdapter("select u_hmqqlsh,qymc,convert(char(10),blqx1,111) blqx1 from sh_qybase_mcdj where u_ztbm='02'", myConnection);DataSet ds = new DataSet();myCommand.Fill(ds, "TX");MyDataGrid.DataSource = ds.Tables["TX"].DefaultView; int number = ds.Tables["TX"].Rows.Count;for(int i=0;i<number;i++){ ds.Tables["TX"].Rows[i].BeginEdit(); ds.Tables["TX"].Rows[i]["qymc"] = "<a href='scydj.aspx?id="+ ds.Tables["TX"].Rows[i]["u_hmqqlsh"].ToString() + "' target='_top'>" + ds.Tables["TX"].Rows[i]["qymc"].ToString() + "</a>"; ds.Tables["TX"].Rows[i].AcceptChanges ();} MyDataGrid.DataBind(); 谢谢 gohome123(渤海),但是我想在我的datagrid中隐藏第一列(请不要叫我重新写sql语句),怎么办啊 ds.Tables ["TX"].Columns .Remove ("ID");ds.Tables ["TX"].Columns .Remove ("UI");ds.Tables ["TX"].Columns .Remove ("NAME");ds.Tables ["TX"].Columns .Remove ("Type_ID"); ds.Tables ["TX"].Columns .Remove ("ID");ds.Tables ["TX"].Columns .Remove ("UI");ds.Tables ["TX"].Columns .Remove ("NAME");ds.Tables ["TX"].Columns .Remove ("Type_ID"); 可恶的日期 日期 发电量 供电量 厂用电 度电煤耗 发电成本 供电成本 备注 1951-1-18 16:45:00 17 3 11 9 7 12 10 2001-1-1 0:00:00 3 5 19 19 19 17 12 我怎么在DATAGRID中去掉time,值要日期 ? ds.Tables ["TX"].Columns[0].Visible=false; 建视图吧vwOrderDate=CONVERT(varchar(10), BO.OrderDate, 20) 这样也行private void DataGrid1_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e){string s1=e.Item .Cells [1].Text ;int len=s1.IndexOf (" ");if(len!=-1)e.Item .Cells [1].Text =s1.Substring (0,len);} to chengwenjian(程文建)在什么地方使用 建视图吧vwOrderDate=CONVERT(varchar(10), BO.OrderDate, 20) 可以这样吗?select convert(char(12),optime,111)optime,opuser from bas_syslog出来得结果肯定是日期没有时间 请问GBK编码的一个问题,把已转的转成汉字 有个题,大家作一下试试看,看能作不能作 ASP.NET回发问题 winform 怎么写配置文件? 图片文件的上传与保存 目录权限问题 关于com的vc代码转成c#,进来就有分 求C#中base64解码 小弟是个初学者,请教各位高手一个问题 如何调用属性框 大家给我一个不由系统调用销毁器而由自已销毁对象的程序吧。我的这个出错书上的,为什么会出错。 谁有C#连接DB2 7.2的经验,我用OleDbCommandBuilder生成不了Update、Delete等语句。
e.item.Cell[i].Controls[j]....
SqlDataAdapter myCommand = new SqlDataAdapter("select u_hmqqlsh,qymc,convert(char(10),blqx1,111) blqx1 from sh_qybase_mcdj where u_ztbm='02'", myConnection);DataSet ds = new DataSet();
myCommand.Fill(ds, "TX");
MyDataGrid.DataSource = ds.Tables["TX"].DefaultView;
int number = ds.Tables["TX"].Rows.Count;
for(int i=0;i<number;i++)
{
ds.Tables["TX"].Rows[i].BeginEdit();
ds.Tables["TX"].Rows[i]["qymc"] = "<a href='scydj.aspx?id="+ ds.Tables["TX"].Rows[i]["u_hmqqlsh"].ToString() + "' target='_top'>" + ds.Tables["TX"].Rows[i]["qymc"].ToString() + "</a>"; ds.Tables["TX"].Rows[i].AcceptChanges ();
}
MyDataGrid.DataBind();
ds.Tables ["TX"].Columns .Remove ("UI");
ds.Tables ["TX"].Columns .Remove ("NAME");
ds.Tables ["TX"].Columns .Remove ("Type_ID");
ds.Tables ["TX"].Columns .Remove ("UI");
ds.Tables ["TX"].Columns .Remove ("NAME");
ds.Tables ["TX"].Columns .Remove ("Type_ID");
1951-1-18 16:45:00 17 3 11 9 7 12 10
2001-1-1 0:00:00 3 5 19 19 19 17 12 我怎么在DATAGRID中去掉time,值要日期 ?
private void DataGrid1_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{string s1=e.Item .Cells [1].Text ;
int len=s1.IndexOf (" ");
if(len!=-1)
e.Item .Cells [1].Text =s1.Substring (0,len);
}
建视图吧vwOrderDate=CONVERT(varchar(10), BO.OrderDate, 20)
select convert(char(12),optime,111)optime,opuser from bas_syslog
出来得结果肯定是日期没有时间