REALBasic 和 MySQL

发布于 2024-11-17 21:41:42 字数 922 浏览 3 评论 0原文

Dim db as MySQLCommunityServer
  db  =New MySQLCommunityServer
  db.host="127.0.0.1"
  db.port=3306
  db.databaseName="requesterdb"
  db.userName="root"
  db.Password=""

  Dim divisionID As String
  Dim supervisorName As String
  Dim lsupervisorTotal As Integer

  If db.Connect then


    dim r as RecordSet
    r=db.SQLSelect("select COUNT(*) As supervisorTotal FROM supervisorTable WHERE supervisorName='" + SupervisorTextField.Text.Trim + "'")

    if r<>nil and r.RecordCount>0 then
      while not r.EOF
        lsupervisorTotal     = r.IdxField(0) // Line with Error
        If lsupervisorTotal > 0 Then
          ' Check User Database and Insert If Needed
        End If

        r.MoveNext
      wend
    end if


  else
    MsgBox "Connection failed!"
  end if

  db.Close

该消息显示“有多个项目具有此名称,但不清楚该调用引用的是哪一项 lSupervisorTotal = r.IdxField(0)”

上面是整个方法,我不知道错误在说什么。

Dim db as MySQLCommunityServer
  db  =New MySQLCommunityServer
  db.host="127.0.0.1"
  db.port=3306
  db.databaseName="requesterdb"
  db.userName="root"
  db.Password=""

  Dim divisionID As String
  Dim supervisorName As String
  Dim lsupervisorTotal As Integer

  If db.Connect then


    dim r as RecordSet
    r=db.SQLSelect("select COUNT(*) As supervisorTotal FROM supervisorTable WHERE supervisorName='" + SupervisorTextField.Text.Trim + "'")

    if r<>nil and r.RecordCount>0 then
      while not r.EOF
        lsupervisorTotal     = r.IdxField(0) // Line with Error
        If lsupervisorTotal > 0 Then
          ' Check User Database and Insert If Needed
        End If

        r.MoveNext
      wend
    end if


  else
    MsgBox "Connection failed!"
  end if

  db.Close

The message says "There are several items with this name and it's not clear which one the call refers to lSupervisorTotal = r.IdxField(0)"

Above is the entire method and I don't know what the error is talking about.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

不再让梦枯萎 2024-11-24 21:41:42

它应该是 r.IdxField(0).integervalue。如果是字符串,则为 r.IdxField(0).stringvalue、日期的 .datevalue 等。

更多信息可以在在线文档中找到,网址为 http://docs.realsoftware.com/index.php/RecordSet.IdxField

It should be r.IdxField(0).integervalue. If it was a string it would be r.IdxField(0).stringvalue, .datevalue for a date, etc.

More info can be found in the online documentation at http://docs.realsoftware.com/index.php/RecordSet.IdxField

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文