Click here to Skip to main content
15,887,135 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
i want to insert image path into sqlite and display that image using angularjs and cordova.

What I have tried:

My current code is as follows:

myDB.transaction(
function(transaction) {
transaction.executeSql('CREATE TABLE IF NOT EXISTS newtb(Name text,img blob)');

var executeQuery = "INSERT INTO newtb(Name,img) VALUES (?,?)";


transaction.executeSql(executeQuery, ['abc','../img/img1.jpg']);


var db = window.sqlitePlugin.openDatabase(...);
db.transaction(function (tx) {
tx.executeSql('Select * from newtb', [], function (tx, results) {

});

now how to push data into an array which i use in ng-repeat
Posted
Updated 18-Aug-16 4:14am
v3
Comments
Richard MacCutchan 17-Aug-16 6:50am    
I have already answered this query more than once: Copy the image file to a location of your choice and save the path in your database. When you want to display the image you can just load it from disk, having found the location from your database.
[no name] 17-Aug-16 6:55am    
i'm new to sqlite and cordova..so please guide me how to do it using sqlite
Richard MacCutchan 17-Aug-16 7:06am    
Did you read my message above? If you do not understand how to save a simple string in SQLite, then I suggest you go back and study the documentation. You really need a clear understanding of all SQLite commands in order to succeed with this. Similar advice would seem to apply to Cordova.
[no name] 17-Aug-16 11:26am    
plz check my code...
Richard MacCutchan 17-Aug-16 11:49am    
For what?

C#
You are inserting the path of the image and not the blob content of the image. You have to correct the type of column for path it should be a nvarchar(255) or like so, but not a blob
 
Share this answer
 
Comments
[no name] 17-Aug-16 7:06am    
ok...then how to retrieve and display that image in angularjs
When you learn to drive a car, you are required to learn all road signs.
It is the same for programming!
You want to use SQL: Learn the language, read documentation, follow tutos, practice.
You want to use Angularjs: Read documentation, follow tutos, practice.
You want to use Cordova: Read documentation, follow tutos, practice.

You already posted the same question and got answers and directions, now it is your turn to work.
Do not expect to code and just have to copy/paste in your app, or ask to a paying service.
 
Share this answer
 
 
Share this answer
 
Comments
[no name] 17-Aug-16 8:01am    
i have done this already.

var db = window.sqlitePlugin.openDatabase(...);
db.transaction(function (tx) {
tx.executeSql('Select * from tbl', [], function (tx, results) {

});
now how to push data into an array which i use in ngrepeat
Richard MacCutchan 17-Aug-16 8:04am    
Why have you posted this here? Please use the Improve question link above and add all the relevant information to your question. If you have some specific code that does not work, then show the code and explain it in proper detail.
[no name] 17-Aug-16 8:08am    
ok

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900