我要将我的数据库的内容显示在里边但是我不想全部显示出来
如:数据库里有:划时代防空洞客观反对
我只想要他显示为:划时代
如:数据库里有:划时代防空洞客观反对
我只想要他显示为:划时代
解决方案 »
- supermap object二次开发,图元查询的问题,进者有分!
- 关于C# 操作word中表的问题
- access 连接 ISAM 问题
- 学了几个月的.net,我还不太了解asp.net和.net的关系?
- 急等!!!
- c#窗口的一个经典问题
- 有没有加/解密高手来看看,我这段代码有什么问题???
- winform项目引用IrisSkin皮肤后无法打包到安装包
- 关于winform中DataGridViewButtonColumn列
- C#,高手进,求一英语分词方法
- 将textbox1.text的值插入数据库中 我convert.int32(textbox1.text)数据库的字段是money的。。。。。
- Substring 关于 索引和长度必须引用该字符串内的位置 的异常, 编译器没搞错吧
private static void SetDataGridTableStyle(string tableName,DataSet dataSet,DataGrid dataGrid)
{
dataGrid.TableStyles.Clear();
DataGridTableStyle tableStyle = new DataGridTableStyle();
tableStyle.MappingName = tableName;
foreach(DataColumn column in dataSet.Tables[0].Columns)
{
DataGridTextBoxColumn columnName = new DataGridTextBoxColumn();
columnName.MappingName = column.Caption;
columnName.HeaderText = column.Caption; if(column.Caption == "ID")
{
columnName.Width = 0;
}
else
{
columnName.Width = 95;
}
tableStyle.GridColumnStyles.Add(columnName);
}
dataGrid.TableStyles.Add(tableStyle);
}
for(int i=0;i<ds.Table[0].Rows.count;i++)
{
string subject=ds.Table[0].Rows["field"].ToString();//你要处理的字段
if (subject.Length >6)
{
subject=subject.Substring(0,6)+"...";
}
}
datgrid1.DataSource=ds;
datagrid1.DataBind();
可以用界面来绑定然后通过CurrencyManager 或BindingContext 来绑定你的字段吗!
那样操作不更加好 !
新闻标题 新闻内容 提交时间 新闻类别 编辑
关于哈哈的告示! 哈哈哈哈哈哈哈哈后 2005-5-31 0:00:00 2 删除 我想要的是
新闻标题 新闻内容 提交时间 新闻类别 编辑
关于哈... 哈哈哈... 2005-5-31 2 删除字段分别为:新闻标题 newstitle 新闻内容 newscontent
select title=substring(title,0,3) from tb_table
select substring(newstitle,0,3)+'...' as newtit,substring(newscontent,0,3)+'...' as newscon from 表名