SQL Command

Aspire89

Member
Licensed User
Hello all.
Recently started to study database SQL.
There is one question.

There is a database whose structure is:

It is necessary to read all the values from the line knowing only def and n.
I read a lot of documentation, but did not find one.
Thank you in advance.
 

Attachments

  • sql.PNG
    16.4 KB · Views: 276

Aspire89

Member
Licensed User
Thank you, to understand himself :sign0060:

B4X:
'Start transaction
    Connection.BeginTransaction
    'Set parameter values
    Command.AddParameter("def")
    Command.SetParameter("def", kod2)
    command.AddParameter("n")
    command.SetParameter("n", kod3&"000")
    Command.CommandText="SELECT * FROM mtt_codes WHERE def=@def AND n<@n AND k>@n"
    'Fetch data
    Reader.Value = Command.ExecuteReader
    
    'Assign data
    If Reader.ReadNextRow = True Then
        Label1.Text = Reader.GetValue(5) & CRLF & Reader.GetValue(6) & CRLF & Reader.GetValue(0)
    End If
    Reader.Close
    ' End transaction
    Connection.EndTransaction
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…