lotus中更新SQL SERVER

米か臹 2009-06-09 04:45:50
SQL SERVER有个字段 status

怎样去修改它的值

下面代码是连接数据库的

Dim str_ipAddress As String
Dim str_userName As String
Dim str_password As String
Dim str_DBName As String
Dim conn As Variant
Dim strConn As String
Dim strsql As String

str_ipAddress = "192.168.1.8"
str_userName = "sa"
str_password ="sa"
str_DBName = "CardData"

Set conn = CreateObject("ADODB.Connection")
strConn = "Provider=SQLOLEDB.1;Persist Security Info=true;Server="+ _
str_ipAddress+";User ID="+str_userName+";pwd="+str_password+";database=" + str_DBName

conn.Open strConn

接下去怎么写呢?请求帮助
...全文
98 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
wavemfk 2009-06-10
  • 打赏
  • 举报
回复
ding
米か臹 2009-06-10
  • 打赏
  • 举报
回复
Const adStateOpen = 1
Const adCmdText = 1
Const adOpenStatic = 3
Const adLockOptimistic = 3

strsql="select * from table"

Set recordSet=CreateObject("ADODB.Recordset")

recordSet.CursorType=1
recordSet.LockType=3
recordSet.Open strsql, conn,adOpenStatic,adLockOptimistic,adCmdText

If recordSet.bof = True And recordSet.eof = True Then
Exit Sub
End If

recordSet.MoveFirst

While(Not recordSet.eof)
recordSet("status ").Value = "0"
recordSet.Update
recordSet.MoveNext
Wend

536

社区成员

发帖
与我相关
我的任务
社区描述
企业开发 Exchange Server
社区管理员
  • 消息协作社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧