Results 1 to 2 of 2
  1. #1
    leonard is offline Member
    Join Date
    Jul 2007
    Posts
    43
    Rep Power
    0

    Default [Microsoft][ODBC SQL Server Driver]Invalid Descriptor Index

    I use a resultset in java to get the data from a table but I get this error
    this is my code:
    Java Code:
         rs.getString("lastname");
         rs.getString("firstname");
    and the error:
    Java Code:
    [Microsoft][ODBC SQL Server Driver]Invalid Descriptor Index
    any ideas?

  2. #2
    leonard is offline Member
    Join Date
    Jul 2007
    Posts
    43
    Rep Power
    0

    Default

    I have found out what the error is.
    When we use a ResultSet object to get the date please note:
    if we use: ResultSetobject.getString("Name of column") we should place these statements in order of the column designed in our database. For example:
    You have 5 columns namely: Field1, Field2, Field3, Field4, Field5.
    If you get them by NAME you should get them in order: The following code will give error:
    Java Code:
         rs.getString("Field2");
         rs.getString("Field1");

    It should be like this:

    Java Code:
         rs.getString("Field1");
         rs.getString("Field2");

Similar Threads

  1. Using JDBC-ODBC bridge
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 02-06-2008, 09:21 AM
  2. connect to microsoft access
    By bbq in forum JDBC
    Replies: 1
    Last Post: 07-09-2007, 03:33 AM
  3. Java Microsoft VM vs JRE SUN
    By Ed in forum New To Java
    Replies: 2
    Last Post: 07-02-2007, 02:09 PM
  4. without ODBC
    By Heather in forum JDBC
    Replies: 2
    Last Post: 06-29-2007, 02:42 PM
  5. Replies: 1
    Last Post: 06-27-2007, 05:57 PM

Posting Permissions

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