property access must assign to the property or use its value
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: property access must assign to the property or use its value

  1. #1
    Join Date
    Dec 2009
    Posts
    1

    property access must assign to the property or use its value

    hi all,
    please help me ti solved the problem,

    my syntax

    Public Sub GenerateNota()
    Dim counter As Integer
    Dim a As Integer
    Dim SQLTEKS As String
    SQLTEKS = DMPOS.TSetting.CommandText
    DMPOS.MSConnection.Close()
    DMPOS.MSConnection.Open()
    DMPOS.TSetting.Parameters.Clear()
    DMPOS.TSetting.Connection = DMPOS.MSConnection
    DMPOS.TSetting.CommandText = SQLTEKS
    DMPOS.TSetting.ExecuteNonQuery()
    a = Int(DMPOS.TSetting.ExecuteReader("No"))
    With DMPOS
    .MSConnection.Close()
    .AdoQuery1.CommandText = ""
    If UUtama.transfer_data Then
    .AdoQuery1.CommandText("select MAX(CONVERT(INT,SUBSTRING( '" & NamaField & "' ,4,5))) as KODE from '" & NamaTable & "' where LEFT('" & NamaField & "',3)= '" & UUtama.NumToStr(a, 3) & "' ")
    Else
    '.AdoQuery1.CommandText("select MAX('" & NamaField & "') as KODE from '" & NamaTable & "' where '" & NamaField & "' <> '" - "' ")
    End If
    .MSConnection.Close()
    Dim data = .AdoQuery1.ExecuteReader
    If Str(data("KODE")) = "" Then
    counter = 1
    Else : counter = Int(data("KODE").Value) + 1
    End If
    If UUtama.transfer_data Then
    EKode.Text = UUtama.NumToStr(a, 3) & UUtama.NumToStr(counter, 5)
    Else : EKode.Text = UUtama.NumToStr(counter, 5)
    End If
    End With
    End Sub

    why this syntax error
    .AdoQuery1.CommandText("select MAX(CONVERT(INT,SUBSTRING( '" & NamaField & "' ,4,5))) as KODE from '" & NamaTable & "' where LEFT('" & NamaField & "',3)= '" & UUtama.NumToStr(a, 3) & "' ")

    the error display is "property access must assign to the property or use its value"

    Help me...

  2. #2
    Join Date
    Oct 2008
    Location
    Cologne, Germany
    Posts
    756

    Re: property access must assign to the property or use its value

    I guess CommandText is a property and you must use the "=" sign to set a new value.

    Code:
    .AdoQuery1.CommandText = "..."
    and next time if you want help then please use code tags and formatting like indents. I have not time to analyze such ugly code.
    win7 x86, VS 2008 & 2010, C++/CLI, C#, .NET 3.5 & 4.0, VB.NET, VBA... WPF is comming

    remeber to give feedback you think my response deserves recognition? perhaps you may want to click the Rate this post link/button and add to my reputation

    private lessons are not an option so please don't ask for help in private, I won't replay

    if you use Opera and you'd like to have the tab-button functionality for the texteditor take a look at my Opera Tab-UserScirpt; and if you know how to stop firefox from jumping to the next control when you hit tab let me know

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center