如何将图像路径插入sqlite并使用angularjs和cordova显示该图像。 [英] How to insert image path into sqlite and display that image using angularjs and cordova.

查看:71
本文介绍了如何将图像路径插入sqlite并使用angularjs和cordova显示该图像。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将图像路径插入sqlite并使用angularjs和cordova显示该图像。



我尝试过:



我目前的代码如下:



myDB.transaction(

函数(交易){

transaction.executeSql('CREATE TABLE IF NOT 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) {



});



现在如何将数据推送到我在ng-中使用的数组中repeat

解决方案

您正在插入图像的路径而不是图像的斑点内容。您必须更正列的类型路径它应该是nvarchar( 255 )或类似的,但不是blob 


当你学会开车时,你需要学习所有的路标。

这是编程也一样!

你想使用SQL:学习语言,阅读文档,遵循tutos,练习。

你想使用Angularjs:阅读文档,关注tutos,练习。

您想使用Cordova:阅读文档,关注tutos,练习。



您已经发布了相同的问题并获得了答案方向,现在轮到你工作。

不要指望编码,只需要复制/粘贴你的应用程序,或者要求付费服务。


< BLOCKQUOTE>

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

解决方案

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


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.



这篇关于如何将图像路径插入sqlite并使用angularjs和cordova显示该图像。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆