1

Here is the declaration:

Public Class Client
Public Property Address() As String
    Get
        Return mAddress

    End Get
    Set(ByVal value As String)
        mAddress = value
    End Set
End Property
Public Property City() As String
    Get
        Return mCity

    End Get
    Set(ByVal value As String)
        mCity = value
    End Set
End Property
end sub

And the ERROR lies in here:

Public Function InsertClientRecordToDb(ByVal cli As Client) As Boolean
        Dim retVal As Boolean
        Dim dataSet As DataSet = New DataSet("dataSet")
        dataSet.EnforceConstraints = False
        'create table adapter object
        Dim ClientTblAdapter As New CaseStudyDBDataSetTableAdapters.Client_TableTableAdapter

    'check db connection
    If ClientTblAdapter.Connection.State = ConnectionState.Closed Then
        ClientTblAdapter.Connection.Open()
    End If

    'perform(insert)
    If ClientTblAdapter.InsertClientRecord(cli.Clientcode, cli.Clientname, cli.Address, cli.City, cli.Contactperson, cli.Contactnumber) > 0 Then
        retVal = True
    End If**

    Return retVal
End Function

The "cli.Address" and "cli.City" was underlined saying:

Value of type String cannot be converted to 1 dimensional array of Byte

What seems to be the problem?

1
  • How is InsertClientRecord defined? Commented Mar 11, 2013 at 2:50

1 Answer 1

1

For the error it seems like you are trying to assign string to Byte()

Something like :

Dim bArr As Byte() = "hello world!"

which is wrong, to convert string to Byte() you need to use the Encoding class

Dim bArr As Byte() = System.Text.Encoding.Default.GetBytes("hello world!")
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.