You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I spend almost 10 hour just to get data from the pre populated database. I place my db file for android in \android\app\src\main\assets
i am using react native version 0.73.4
here is my code
import SQLite from 'react-native-sqlite-storage';
const initializeDatabase = async () => {
try {
const db = await SQLite.openDatabase({
name: 'kitabosunnat.db',
createFromLocation: '~kitabosunnat.db',
});
await db.transaction(tx => {
tx.executeSql(
'SELECT * FROM Favrouit',
[],
(tx, results) => {
const temp = [];
const rows = results.rows;
for (let i = 0; i < rows.length; i++) {
console.log('Row:', rows.item(i));
temp.push(rows.item(i));
// Process and use the data as needed
}
setData(temp);
},
error => {
console.error('Error executing SQL query:', error);
},
);
});
} catch (error) {
console.error('Error initializing database:', error);
}
};
useEffect(() => {
initializeDatabase();
console.log(data);
}, []);
with all the solution i searched on google i still have the following problem
Error executing SQL query {"code": 0, "message": "no such table: categories (code 1 SQLITE_ERROR): , while compiling: SELECT * FROM categories"}
Note: table is present in the database with correct spelling
i have tried all the solution but cannot succeed
The text was updated successfully, but these errors were encountered:
I spend almost 10 hour just to get data from the pre populated database. I place my db file for android in \android\app\src\main\assets
i am using react native version 0.73.4
here is my code
import SQLite from 'react-native-sqlite-storage';
const initializeDatabase = async () => {
try {
};
useEffect(() => {
initializeDatabase();
console.log(data);
}, []);
with all the solution i searched on google i still have the following problem
Error executing SQL query {"code": 0, "message": "no such table: categories (code 1 SQLITE_ERROR): , while compiling: SELECT * FROM categories"}
Note: table is present in the database with correct spelling
i have tried all the solution but cannot succeed
The text was updated successfully, but these errors were encountered: