Skip to content

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

Open
@saurabhj91

Description

@saurabhj91

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions