c# 对access数据库 如何 进行修改 25
我用的是access数据库,三个字段,idwordrawexplanation例如:idwordrawexplanation1我d\\...\\...\\yme我想用程序...
我用的是access数据库, 三个字段,id word rawexplanation
例如: id word rawexplanation
1 我 d\\...\\...\\y me
我想用程序把 rawexplanation 字段里的d\\...\\...\\y部分去掉,每条记录的d\\...\\...\\y部分不一样,只留下 me.怎么做?急用!
我写了一个程序,但是老是出错!
string SQLCmd = "Select rawexplanation From words_final'" + "where len(word)=1 order by id asc";
System.Data.OleDb.OleDbConnection aConnection = new System.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\\Duiqi\\mydb.mdb");
aConnection.Open();
DataSet DS = new DataSet();
//dataSet1.Clear();
System.Data.OleDb.OleDbDataAdapter comm = new System.Data.OleDb.OleDbDataAdapter(SQLCmd, aConnection);
// comm.FillSchema(DS, SchemaType.Source, "Words_final");
comm.Fill(DS, "Words_final");
for (int i = 0; i < DS.Tables["Words_final"].Rows.Count; i++)
//foreach (DataRow rawexplanation in DS.Tables["words_final"].Rows)
{
string str = DS.Tables["Words_final"].Rows[i][0].ToString();
textBox1.Text = str.Substring(str.LastIndexOf("\\") + 2);
DS.Tables["Words_final"].Rows[i][0] = textBox1.Text;
OleDbCommandBuilder mybuilder = new OleDbCommandBuilder(comm);
}
comm.Update(DS,"words_final");
DS.Tables["words_final"].AcceptChanges();
aConnection.Close();
}
id ---------------1
word------------ 我
rawexplanation------d\\...\\...\\y me 展开
例如: id word rawexplanation
1 我 d\\...\\...\\y me
我想用程序把 rawexplanation 字段里的d\\...\\...\\y部分去掉,每条记录的d\\...\\...\\y部分不一样,只留下 me.怎么做?急用!
我写了一个程序,但是老是出错!
string SQLCmd = "Select rawexplanation From words_final'" + "where len(word)=1 order by id asc";
System.Data.OleDb.OleDbConnection aConnection = new System.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\\Duiqi\\mydb.mdb");
aConnection.Open();
DataSet DS = new DataSet();
//dataSet1.Clear();
System.Data.OleDb.OleDbDataAdapter comm = new System.Data.OleDb.OleDbDataAdapter(SQLCmd, aConnection);
// comm.FillSchema(DS, SchemaType.Source, "Words_final");
comm.Fill(DS, "Words_final");
for (int i = 0; i < DS.Tables["Words_final"].Rows.Count; i++)
//foreach (DataRow rawexplanation in DS.Tables["words_final"].Rows)
{
string str = DS.Tables["Words_final"].Rows[i][0].ToString();
textBox1.Text = str.Substring(str.LastIndexOf("\\") + 2);
DS.Tables["Words_final"].Rows[i][0] = textBox1.Text;
OleDbCommandBuilder mybuilder = new OleDbCommandBuilder(comm);
}
comm.Update(DS,"words_final");
DS.Tables["words_final"].AcceptChanges();
aConnection.Close();
}
id ---------------1
word------------ 我
rawexplanation------d\\...\\...\\y me 展开
1个回答
展开全部
不晓得,帮顶 不晓得,帮顶
不晓得,帮顶
不晓得,帮顶
不晓得,帮顶不晓得,帮顶 System.Data.OleDb.OleDbDataAdapter comm = new System.Data.OleDb.OleDbDataAdapter(SQLCmd, aConnection);
// comm.FillSchema(DS, SchemaType.Source, "Words_final");
comm.Fill(DS, "Words_final");
for (int i = 0; i < DS.Tables["Words_final"].Rows.Count; i++)
//foreach (DataRow rawexplanation in DS.Tables["words_final"].Rows)
{
string str = DS.Tables["Words_final"].Rows[i][0].ToString();
textBox1.Text = str.Substring(str.LastIndexOf("\\") +
不晓得,帮顶
不晓得,帮顶
不晓得,帮顶不晓得,帮顶 System.Data.OleDb.OleDbDataAdapter comm = new System.Data.OleDb.OleDbDataAdapter(SQLCmd, aConnection);
// comm.FillSchema(DS, SchemaType.Source, "Words_final");
comm.Fill(DS, "Words_final");
for (int i = 0; i < DS.Tables["Words_final"].Rows.Count; i++)
//foreach (DataRow rawexplanation in DS.Tables["words_final"].Rows)
{
string str = DS.Tables["Words_final"].Rows[i][0].ToString();
textBox1.Text = str.Substring(str.LastIndexOf("\\") +
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询