标题:看看这个数据库的问题?
只看楼主
红蔷薇Love
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2005-12-28
 问题点数:0 回复次数:1 
看看这个数据库的问题?
'获取文本框内容
Dim sname As String = "'" & txtname.Text & " '"
Dim skemu As String = "'" & txtkemu.Text & " '"
Dim sjf As String = "'" & txtjf.Text & " '"
Dim stel As String = "'" & txttel.Text & " '"
Dim sschool As String = "'" & txtschool.Text & " '"
Dim syp As String = "'" & txtyp.Text & " '"
Dim sdemo As String = "'" & txtdemo.Text & " '"
Dim currentid As String = txtid.Text
'MessageBox.Show(currentid)
'定义更新SQL语句
Dim updatestr As String = "update detail set"
updatestr = updatestr & " name=" & sname
updatestr = updatestr & ", kumu=" & skemu
updatestr = updatestr & ", jf=" & sjf
updatestr = updatestr & ", yp=" & syp
updatestr = updatestr & ", tel=" & stel
updatestr = updatestr & ", school=" & sschool
updatestr = updatestr & ", demo=" & sdemo
updatestr = updatestr & " where id=" & currentid
MessageBox.Show(updatestr)
'打开连接并执行更新操作
OleDbConnection1.Open()
OleDbDataAdapter1.UpdateCommand.CommandText = updatestr
OleDbDataAdapter1.UpdateCommand.ExecuteNonQuery()
'重新填充数据集并关闭连接
DataSet11.Clear()
OleDbDataAdapter1.Fill(DataSet11)
OleDbConnection1.Close()
Else
'否则重新填充数据集
DataSet11.Clear()
OleDbDataAdapter1.Fill(DataSet11)
End If


连接的是ACCESS的语句
提示UPDATE 语句错误
请教.................. 急 !!!!!!!!! 在线等 谢谢了
搜索更多相关主题的帖子: 数据库 
2006-01-08 16:51
pygjf
Rank: 1
等 级:新手上路
帖 子:24
专家分:0
注 册:2005-12-28
得分:0 

是不是太复杂了
Dim sname As String = "'" & txtname.Text & " '"
Dim skemu As String = "'" & txtkemu.Text & " '"
Dim sjf As String = "'" & txtjf.Text & " '"
Dim stel As String = "'" & txttel.Text & " '"
Dim sschool As String = "'" & txtschool.Text & " '"
Dim syp As String = "'" & txtyp.Text & " '"
Dim sdemo As String = "'" & txtdemo.Text & " '"
Dim currentid As String = txtid.Text
'MessageBox.Show(currentid)
'定义更新SQL语句
Dim updatestr As String = "update detail set"
updatestr = updatestr & " name=" & sname
updatestr = updatestr & ", kumu=" & skemu
updatestr = updatestr & ", jf=" & sjf
updatestr = updatestr & ", yp=" & syp
updatestr = updatestr & ", tel=" & stel
updatestr = updatestr & ", school=" & sschool
updatestr = updatestr & ", demo=" & sdemo
updatestr = updatestr & " where id=" & currentid
dim cmd as new oledbcommand
cmd.commandtext=updatestr
cmd.connction=conn
cmd..ExecuteNonQuery

2006-01-08 18:32



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-42043-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.032113 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved