Skip to content

Can Update but can't Select rows #11

Description

@MujtabaFR

Hi,
I'm using react-native-mssql on react-native 0.59.9 on Android

I'm able to update the rows in my MSSQL database, but when trying to select any rows.. it throws multiple errors.. couldn't find why

  let sqlConfig = {
      server: '192.168.2.107', //ip address of the mssql database
      username: 'sa', //username to login to the database
      password: 'aaaaa', //password to login to the database
      database: 'new', //the name of the database to connect to
      port: 1433, //OPTIONAL, port of the database on the server
      // timeout: 10  //OPTIONAL, login timeout for the server
  };

  MSSQL.connect(sqlConfig)
  .then(() => {
      console.log('Did connect');
      //  let query = 'UPDATE USERS SET Status=2;  // works perfectly
      let query = 'SELECT TOP 1 * FROM USERS';  // not working
      MSSQL.executeQuery(query)
      .then(rows => {
          console.log(rows);
          MSSQL.close();
      })
      .catch(error => {
          console.log('Query error!', 'Querry: ' + query + '\r\nError: ' + JSON.stringify(error));
          console.warn(error);
          MSSQL.close();
      });
  })
  .catch(error => {
      Alert.alert('Connect error!', JSON.stringify(error));
  });

I'm getting these errors

Screen Shot 2019-07-02 at 5 54 04 AM

Did connect
-------------------------------------------
Query error! Querry: SELECT TOP 1 * FROM USERS
Error: {"framesToPop":1,"nativeStackAndroid":[],"userInfo":null,"code":"REACT-NATIVE-MSSQL"}
-------------------------------------------
Error: byte[] cannot be cast to java.lang.Object[]

Could you please provide any help about this issue ?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions