react-native-sqlite-2 icon indicating copy to clipboard operation
react-native-sqlite-2 copied to clipboard

Error on react-native-windows - Cannot read property 'exec' of undefined when running executeSql

Open saurabhj91 opened this issue 4 years ago • 3 comments

Hi There,

I'm working on react-native-windows, below is the version information

"react": "17.0.1",
"react-native": "0.64.0",
"react-native-windows": "^0.64.0-0"
"react-native-sqlite-2": "^3.3.0",

I was able to open the database as mentioned in the docs, while executing the query I am getting the error Uncaught TypeError: Cannot read property 'exec' of undefined at SQLiteDatabase.exec

Below is the code of executing the query,

db.transaction(txn => {
        console.log(txn);
        txn.executeSql(
            "CREATE TABLE IF NOT EXISTS USERS(user_id INTEGER PRIMARY KEY NOT NULL, name NVARCHAR(30), password NVARCHAR(8))",
            [],
            successCB,
            errorCB
        );

I have also added console for db and txn to check if anything is not working on that side, but as you can see the console for db and txn are coming. Below are the screenshots of the same

image

image

Please let me know if I have missed any step or need to add any dependency which is causing the issue.

saurabhj91 avatar Apr 28 '21 11:04 saurabhj91

Windows support is out of scope for me. Maybe @hnq90 can help you.

craftzdog avatar Apr 29 '21 02:04 craftzdog

Any solution to this issue? I'm also currently facing the same challenge please help. I have the following versions running,

"react": "17.0.1",
"react-native": "0.64.1",
"react-native-sqlite-2": "^3.4.1",
"react-native-windows": "0.64.17",

emaitee avatar Sep 13 '21 11:09 emaitee

@emaitee No update, we ditched react native.

saurabhj91 avatar Sep 13 '21 13:09 saurabhj91