[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 667
  • Last Modified:

Syntax error: Missing operand after 'client' operator

Using this code;

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

dv = DataSet11.Tables("client").DefaultView
        dv2 = DataSet21.Tables("document").DefaultView
        cm = CType(Me.BindingContext(dv), CurrencyManager)


Public Sub FindRecords(ByVal SearchPattern As String)

        dv2.RowFilter = SearchPattern
       
    End Sub


Public Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Dim sstring As String
        Dim Frm As Form1
        sstring = "SELECT * FROM client WHERE cli_seq = '" & DataSet11.Tables(0).Rows(RowIndex).Item("cli_seq") & "'"
        CType(Me, Form1).FindRecords(sstring)

    End Sub

I get: Syntax error: Missing operand after 'client' operator.

I am at a loss and not sure where to go from here.  All of the commands are correctly named.  Anyone got any ideas?
0
matt_swinburne
Asked:
matt_swinburne
  • 2
1 Solution
 
Fernando SotoCommented:
Hi matt_swinburne;

I believe that the following two lines should read

dv = DataSet11.Tables.Item("client").DefaultView
dv2 = DataSet21.Tables.Item("document").DefaultView

and not

dv = DataSet11.Tables("client").DefaultView
dv2 = DataSet21.Tables("document").DefaultView
0
 
grayeCommented:
The RowFilter property doesn't expect a fully formed SQL statement like what you've got... it expects just the "where clause" portion of the full SQL statement.

So, change it to read
        sstring = "cli_seq = '" & DataSet11.Tables(0).Rows(RowIndex).Item("cli_seq") & "'"
0
 
matt_swinburneAuthor Commented:
That seeeeeemed to work but im not sure because it doesnt return any results.  The error is gone but none of my combo boxes get filled.

Have you got any tips,  i will post my code as follows;

Inherits System.Windows.Forms.Form
    Public dv As DataView
    Public dv2 As DataView
    Dim cm As CurrencyManager
    Dim cm2 As CurrencyManager
    Dim RowIndex As Integer
    Dim CurrentRecord As Integer

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        dv = DataSet11.Tables("client").DefaultView
        dv2 = DataSet21.Tables("document").DefaultView
        cm = CType(Me.BindingContext(dv), CurrencyManager)

        'Fill Database
        DbClient.Fill(DataSet11, "client")
        DbDocType.Fill(DataSet11, "doctype")
        DbDocument.Fill(DataSet11, "document")
        DbFeeEarner.Fill(DataSet11, "feeearner")
        DbLocation.Fill(DataSet11, "location")

        'Bind Textboxes Client
        TxtTitle.DataBindings.Add("Text", dv, "cli_title")
        TxtForename.DataBindings.Add("Text", dv, "cli_forname")
        TxtSurname.DataBindings.Add("Text", dv, "cli_surname")
        TxtAddress1.DataBindings.Add("Text", dv, "cli_add1")
        TxtAddress2.DataBindings.Add("Text", dv, "cli_add2")
        TxtAddress3.DataBindings.Add("Text", dv, "cli_add3")
        TxtTown.DataBindings.Add("Text", dv, "cli_town")
        TxtCounty.DataBindings.Add("Text", dv, "cli_county")
        TxtCountry.DataBindings.Add("Text", dv, "cli_country")
        TxtPostCode.DataBindings.Add("Text", dv, "cli_postcode")
        TxtPhoneHome.DataBindings.Add("Text", dv, "cli_hometel")
        TxtPhoneWork.DataBindings.Add("Text", dv, "cli_worktel")
        TxtPhoneMobile.DataBindings.Add("Text", dv, "cli_mobiletel")
        TxtEmail.DataBindings.Add("Text", dv, "cli_emailtel")
        TxtFax.DataBindings.Add("Text", dv, "cli_faxtel")
        TxtAIM.DataBindings.Add("Text", dv, "cli_aimref")

        'Bind ComboBoxes Client
        CmbPartner.DataBindings.Add("Text", dv, "fe_name")
        CmbFeeEarner.DataBindings.Add("Text", dv, "fe_name1")

        'Bind Textboxes Document
        CmbDocDesc.DataSource = DataSet21.Tables("document")
        CmbDocDesc.DisplayMember = "doc_description"
        CmbDocDesc.ValueMember = "cli_seq"
        CmbDocDesc.DataBindings.Add("selectedvalue", dv2, "cli_seq")

        CmbDocFileDate.DataSource = DataSet21.Tables("document")
        CmbDocFileDate.DisplayMember = "doc_filedate"
        CmbDocFileDate.ValueMember = "cli_seq"
        CmbDocFileDate.DataBindings.Add("selectedvalue", dv2, "cli_seq")

        CmbFiled.DataSource = DataSet21.Tables("document")
        CmbFiled.DisplayMember = "doc_filedby"
        CmbFiled.ValueMember = "cli_seq"
        CmbFiled.DataBindings.Add("selectedvalue", dv2, "cli_seq")

        CmbStorageLocation.DataSource = DataSet21.Tables("document")
        CmbStorageLocation.DisplayMember = "doc_description"
        CmbStorageLocation.ValueMember = "cli_seq"
        CmbStorageLocation.DataBindings.Add("selectedvalue", dv2, "cli_seq")

    End Sub

    Public Sub FindRecords(ByVal SearchPattern As String)
        Try
            dv2.RowFilter = SearchPattern
        Catch Ex As Exception
            MsgBox(Ex.Message)
        End Try
    End Sub

    Private Sub NavigationButtons_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnFirst1.Click, BtnLast1.Click, BtnRight1.Click, BtnLeft1.Click
        Select Case sender.Name

            Case "BtnFirst1"

                cm.Position = 0


            Case "BtnLeft1"

                cm.Position -= 1


            Case "BtnRight1"

                cm.Position += 1


            Case "BtnLast1"

                cm.Position = dv.Count - 1


        End Select
   
    End Sub

    Private Sub NavigationButtons2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnFirst2.Click, BtnLast2.Click, BtnRight2.Click, BtnLeft2.Click
        Select Case sender.Name
            Case "BtnFirst2"

                cm2.Position = 0

            Case "BtnLeft2"

                cm2.Position -= 1

            Case "BtnRight2"

                cm2.Position += 1

            Case "BtnLast2"

                cm2.Position = dv2.Count - 1

        End Select

    End Sub

    Public Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Dim sstring As String
        sstring = "cli_seq = '" & DataSet11.Tables(0).Rows(RowIndex).Item("cli_seq") & "'"
        CType(Me, Form1).FindRecords(sstring)

    End Sub
End Class
0
 
matt_swinburneAuthor Commented:
Hi Ronald, I was hoping you would answer my post!
I am using this code to populate the textboxes with the client details (More than one record for every client)

    'Bind Textboxes Client
        TxtTitle.DataBindings.Add("Text", dv, "cli_title")
        TxtForename.DataBindings.Add("Text", dv, "cli_forname")
        TxtSurname.DataBindings.Add("Text", dv, "cli_surname")
        TxtAddress1.DataBindings.Add("Text", dv, "cli_add1")
        TxtAddress2.DataBindings.Add("Text", dv, "cli_add2")
        TxtAddress3.DataBindings.Add("Text", dv, "cli_add3")
        TxtTown.DataBindings.Add("Text", dv, "cli_town")
        TxtCounty.DataBindings.Add("Text", dv, "cli_county")
        TxtCountry.DataBindings.Add("Text", dv, "cli_country")
        TxtPostCode.DataBindings.Add("Text", dv, "cli_postcode")
        TxtPhoneHome.DataBindings.Add("Text", dv, "cli_hometel")
        TxtPhoneWork.DataBindings.Add("Text", dv, "cli_worktel")
        TxtPhoneMobile.DataBindings.Add("Text", dv, "cli_mobiletel")
        TxtEmail.DataBindings.Add("Text", dv, "cli_emailtel")
        TxtFax.DataBindings.Add("Text", dv, "cli_faxtel")
        TxtAIM.DataBindings.Add("Text", dv, "cli_aimref")


Then I want these comboboxes to display just the records from the client selected with Button1

Coding for combo boxes


  'Bind Textboxes Document
        CmbDocDesc.DataSource = DataSet21.Tables("document")
        CmbDocDesc.DisplayMember = "doc_description"
        CmbDocDesc.ValueMember = "cli_seq"
        CmbDocDesc.DataBindings.Add("selectedvalue", dv2, "cli_seq")

        CmbDocFileDate.DataSource = DataSet21.Tables("document")
        CmbDocFileDate.DisplayMember = "doc_filedate"
        CmbDocFileDate.ValueMember = "cli_seq"
        CmbDocFileDate.DataBindings.Add("selectedvalue", dv2, "cli_seq")

        CmbFiled.DataSource = DataSet21.Tables("document")
        CmbFiled.DisplayMember = "doc_filedby"
        CmbFiled.ValueMember = "cli_seq"
        CmbFiled.DataBindings.Add("selectedvalue", dv2, "cli_seq")

        CmbStorageLocation.DataSource = DataSet21.Tables("document")
        CmbStorageLocation.DisplayMember = "doc_description"
        CmbStorageLocation.ValueMember = "cli_seq"
        CmbStorageLocation.DataBindings.Add("selectedvalue", dv2, "cli_seq")

0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now