- Home
- Products
- Integration
- Tutorial
- Barcode FAQ
- Purchase
- Company
Using the IN modifier in the WHERE clause in Java
Listing 11-38 Using the IN modifier in the WHERE clause Painting PDF 417 In Java Using Barcode drawer for Java Control to generate, create PDF417 image in Java applications. Recognize PDF 417 In Java Using Barcode scanner for Java Control to read, scan read, scan image in Java applications. try { String query = new String ("SELECT " + "FirstName, LastName, Street, City, State, ZipCode, Sales " + " FROM Customers " + " WHERE Sales NOT IN (20000, 30000, 40000) " ); DataRequest = DatabasecreateStatement(); Results = DataRequestexecuteQuery (query); Bar Code Printer In Java Using Barcode generator for Java Control to generate, create bar code image in Java applications. Recognizing Barcode In Java Using Barcode reader for Java Control to read, scan read, scan image in Java applications. 11: PDF-417 2d Barcode Generator In C#.NET Using Barcode generator for .NET Control to generate, create PDF417 image in .NET applications. Create PDF417 In .NET Using Barcode generation for ASP.NET Control to generate, create PDF417 image in ASP.NET applications. JDBC and Embedded SQL
Paint PDF 417 In .NET Framework Using Barcode encoder for .NET Control to generate, create PDF-417 2d barcode image in VS .NET applications. PDF 417 Maker In Visual Basic .NET Using Barcode printer for .NET framework Control to generate, create PDF-417 2d barcode image in .NET framework applications. DisplayResults (Results); DataRequestclose(); } Encode ECC200 In Java Using Barcode maker for Java Control to generate, create Data Matrix ECC200 image in Java applications. EAN128 Drawer In Java Using Barcode printer for Java Control to generate, create GTIN - 128 image in Java applications. Metadata
GS1 DataBar Stacked Creator In Java Using Barcode printer for Java Control to generate, create GS1 DataBar-14 image in Java applications. Paint Matrix Barcode In Java Using Barcode maker for Java Control to generate, create 2D Barcode image in Java applications. Metadata is data that describes data, which you learned about in 6 Metadata is returned with the ResultSet object and can be extracted from the ResultSet object by creating a ResultSetMetaData Techniques for doing this are described in the next several sections of this chapter Metadata can be used in a J2ME application for various purposes, such as to display the column name of a column and determine the data type of a column The most commonly used metadata are Column name Column number Column data type Interleaved 2 Of 5 Maker In Java Using Barcode generation for Java Control to generate, create 2 of 5 Interleaved image in Java applications. Barcode Generator In .NET Framework Using Barcode drawer for Reporting Service Control to generate, create barcode image in Reporting Service applications. J2ME DATA MANAGEMENT
Bar Code Reader In VB.NET Using Barcode reader for Visual Studio .NET Control to read, scan read, scan image in Visual Studio .NET applications. DataMatrix Drawer In Objective-C Using Barcode printer for iPad Control to generate, create Data Matrix image in iPad applications. Column width
Bar Code Decoder In Visual C# Using Barcode scanner for VS .NET Control to read, scan read, scan image in Visual Studio .NET applications. Generating Barcode In None Using Barcode drawer for Font Control to generate, create bar code image in Font applications. Number of Columns in ResultSet
Bar Code Recognizer In .NET Framework Using Barcode scanner for .NET framework Control to read, scan read, scan image in VS .NET applications. Print Bar Code In Java Using Barcode creation for BIRT Control to generate, create bar code image in BIRT reports applications. Listing 11-39 contains the DownRow() method that illustrates how to determine the number of columns in the ResultSet The getMetaData() method is called to extract metadata from the ResultSet The getMetaData() method returns a ResultSetMetaData object, which is called metadata in this example The ResultSetMetaData object contains several methods that are used to copy specific metadata from the ResultSet In this example, the getColumnCount() method is called to retrieve the number of columns contained in the result set, which is then assigned to the NumberOfColumns variable and printed on the screen using the println() method (This doesn t work with all drivers) The DownRow() method in Listing 11-39 can replace the DownRow() method in the Model B program and be used in any version of the Model B program presented in this chapter Of course, the DownRow() method must be modified to copy and display data contained in the ResultSet, as shown previously in this chapter Listing 11-39 Determining the number of columns in a ResultSet private void DownRow ( ResultSet DisplayResults )throws SQLException { ResultSetMetaData metadata = DisplayResultsgetMetaData (); int NumberOfColumns; String printrow; NumberOfColumns = metadatagetColumnCount (); Systemoutprintln("Number Of Columns: " + NumberOfColumns); } J2ME: The Complete Reference
Data Type of Column
Listing 11-40 illustrates how to determine the data type of a column You ll notice that this technique is very similar to the technique for retrieving the number of columns in the ResultSet described in the previous section In this example the getColumnTypeName() method is called to copy the data type from column nine of the result set to the ColumnType object Any valid column number in the ResultSet can be passed to the getColumnTypeName() method You can use the data type returned by the getColumnTypeName() method to determine the proper getXXX() method to use to copy data from the ResultSet The type is returned as the native type, not the SQL type Listing 11-40 Determining the data type of columns in a ResultSet private void DownRow ( ResultSet DisplayResults ) throws SQLException { ResultSetMetaData metadata = DisplayResultsgetMetaData (); String ColumnType = new String(); String printrow; ColumnType = metadatagetColumnTypeName ( 9 ); Systemoutprintln("Column Type: " + ColumnType ); } Name of Column
Retrieving the column name from the metadata uses a process similar to copying the data type of a column from the metadata In the example in Listing 11-41, the getColumnLabel() method is used to copy the column name from a specific column and assign the column name to the String object ColumnName The number of the column in the ResultSet is passed to the getColumnLabel() method Listing 11-41 Determining the names of columns in a ResultSet private void DownRow ( ResultSet DisplayResults ) throws SQLException { ResultSetMetaData metadata = DisplayResultsgetMetaData (); String ColumnName = new String(); String printrow; ColumnName = metadatagetColumnLabel (9) ; Systemoutprintln("Column Name: " + ColumnName); } Column Size
The column size, also referred to as the column width, is called the display size and represents the number of characters needed to display the maximum value that might be stored in the column You retrieve the display size by using the getColumnDisplaySize( ) method, as illustrated in Listing 11-42 This listing is similar to the others in the metadata sections The getColumnDisplaySize( ) is called and passed the number of the column whose 11:
|
|