Query Method (String, Int32)

NI-VisaNS .NET Class Library Help for Visual Studio 2010

Edition Date: August 2012

Part Number: 370627F-01

»View Product Info
Download Help (Windows Only)

VxiSession Class See Also


Performs a synchronous write of ASCII-encoded string data, followed by a synchronous read of a specified number of characters.

Namespace: NationalInstruments.VisaNS

Assembly: NationalInstruments.VisaNS (in NationalInstruments.VisaNS.dll) Version: 13.0.40.167

Syntax

Visual Basic (Declaration)
Public Function Query ( _
	dataToWrite As String, _
	countToRead As Integer _
) As String

C#
public string Query(
	string dataToWrite,
	int countToRead
)

Parameters

dataToWrite
Type: System.String
String data to write.
countToRead
Type: System.Int32
Number of characters to read from the device.

Return Value

String data read from the device.

Implements

IMessageBasedSession.Query(String, Int32)

Exceptions

ExceptionCondition
VisaException The NI-VISA driver returned an error as a result of calling this method.
DllNotFoundException The NI-VISA driver library cannot be found.
EntryPointNotFoundException A required operation in the NI-VISA driver library cannot be found.
InvalidOperationException Unable to start operation because setup is invalid (due to properties being set to an inconsistent state).
ObjectDisposedException This member is called after the Dispose method is called directly from code or indirectly through a finalizer.

Remarks

If you need to write and read string data in an encoding other than ASCII, such as Unicode, perform the following steps:

  1. Use the Encoding class to convert the write string to a byte array.
  2. Call the Query(byte[]) method or the Query(byte[], int) method to write the byte array and read the response.
  3. Use the Encoding class to convert the returned byte array to a string.

See Also

Reference

VxiSession Class

NationalInstruments.VisaNS Namespace

WAS THIS ARTICLE HELPFUL?

Not Helpful