rows count不是整数的成员 [英] rows count is not a member of integer

查看:155
本文介绍了rows count不是整数的成员的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在visual basic上创建一个 DataGridView ,但是我遇到了这个 RowsCount 。

I'm trying to create an DataGridView on visual basic, however I'm having a problem with this RowsCount.

此代码带有下划线蓝色:

This code is underlined blue:

 SQL.SQLDA.Fill(SQL.SQLDS, "GettingInfo").RowsCount 

它说 RowsCount是不是整数的成员。

这是该过程的所有代码:

This is all of the code for the process:

      Public Sub LoadBookingData()
    Dim loadSQL As String = "SELECT * FROM booking"
    Dim RowsCount As Integer


    If SQL.SQLCon.State = ConnectionState.Closed Then
        SQL.SQLCon.open()
        SQL.SQLDA.Fill(SQL.SQLDS, "GettingInfo").
        RowsCount = SQL.SQLDS.Tables("GettingInfo").Rows.Count
        If RowsCount < 1 Then
            MsgBox("There is no records", MsgBoxStyle.Critical, "Sorry")
            SQL.SQLDS.Reset()
            SQL.SQLCon.Close()
        Else
            ' there are records !
            DGVData.Rows.Add(RowsCount)
            For i As Integer = 0 To RowsCount - 1
                With DGVData
                    .Rows(1).Cells(0).Value = SQL.SQLDS.Tables("GettingInfo").Rows(i).Item("bookingID")
                    .Rows(1).Cells(0).Value = SQL.SQLDS.Tables("GettingInfo").Rows(i).Item("paymentConfirmation")
                    .Rows(1).Cells(0).Value = SQL.SQLDS.Tables("GettingInfo").Rows(i).Item("totalCost")
                End With
            Next
        End If
        SQL.SQLDS.Reset()
        SQL.SQLCon.Close()

    Else
        ' the connection is already open 
        SQL.SQLDA.Fill(SQL.SQLDS, "GettingInfo").
        RowsCount = SQL.SQLDS.Tables("GettingInfo").Rows.Count
        If RowsCount < 1 Then
            MsgBox("There is no records", MsgBoxStyle.Critical, "Sorry")
            SQL.SQLDS.Reset()
            SQL.SQLCon.Close()
        Else
            ' there are records !
            DGVData.Rows.Add(RowsCount)
            For i As Integer = 0 To RowsCount - 1
                With DGVData
                    .Rows(1).Cells(0).Value = SQL.SQLDS.Tables("GettingInfo").Rows(i).Item("bookingID")
                    .Rows(1).Cells(0).Value = SQL.SQLDS.Tables("GettingInfo").Rows(i).Item("paymentConfirmation")
                    .Rows(1).Cells(0).Value = SQL.SQLDS.Tables("GettingInfo").Rows(i).Item("totalCost")
                End With
            Next
        End If
        SQL.SQLDS.Reset()
        SQL.SQLCon.Close()
    End If
End Sub

这是SQLControl的代码:

This is the code for SQLControl:

    Imports System.Data.SqlClient
    Public Class SQLControl
           Public SQLCon As New SqlConnection With {.ConnectionString = "Data Source=JENNIFER\DDAP2015;Initial Catalog=zachtravelagency;Integrated Security=True;"}
           Private SQLcmd As SqlCommand
           Public SQLDA As SqlDataAdapter
           Public SQLDS As DataSet

有人可以点为什么会这样说?

Can someone point out why it is saying this?

推荐答案

删除点 SQL.SQLDA.Fill(SQL.SQLDS,GettingInfo)。

它归类为< VB.Net中的一个href =https://msdn.microsoft.com/en-us/library/vstudio/865x40k4(v=vs.100).aspx\"rel =nofollow>隐含线延续

这篇关于rows count不是整数的成员的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆