none
how to use sqlite-net to windows 8 javascript app

    Question

  • Hi,

       Is there any possibility to use sqlite-net (winrt wrapper using c#, which is have sqlite.cs and sqliteAsync.cs) in html5/javascript app.how to use create,update,insert methods from sqlite-net  in javascript.any help would be appreciated

    Tuesday, December 24, 2013 10:45 AM

Answers

  • Hi suganthe,

    Why not. Theoretically speaking its ok, but the SQLite access conflict might be a problem.

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Tuesday, January 21, 2014 9:52 AM
    Moderator
  • Hi suganthe,

    I'd like to know why can't you write queries with JavaScript? Normally you need create a Runtime Component by C#, ref: Creating Windows Runtime Components in C# and Visual Basic. Also you need to define the table by coding C# as below:

    public class Post
    {
        [PrimaryKey]
        public int Id { get; set; }
        public string Title { get; set; }
        public string Text { get; set; }
    }
    
    

    Include the C# Runtime Component in your WinJS, and use it. The CRUD operation is a kind of passing the parameter and execute it by C#. Read this for more information: Walkthrough: Creating a simple component in C# or Visual Basic and calling it from JavaScript

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Friday, December 27, 2013 12:13 PM
    Moderator

All replies

  • Hi suganthe balajee,

    Yes, there is a detail described documentation for you: http://msdn.microsoft.com/en-us/library/windows/apps/dn263243.aspx. HTML5/JavaScript should be similar as C#, You could write some C# code and use it as Runtime Component in WinJS.

    Or try this: https://github.com/doo/SQLite3-WinRT Should be easier for you to write JavaScript code.

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Wednesday, December 25, 2013 2:12 AM
    Moderator
  • Hi Jamles,

              I tried with 2 approaches which is suggested by you,

        1) https://github.com/doo/SQLite3-WinRT  its working fine on debug mode but shows error on release mode

        2)tried with c# run time component using this i couldn't able to write queries in javascript .

          I wanna use db on both javascript and c# runtime component. help me pls

    Thursday, December 26, 2013 11:00 AM
  • Hi suganthe,

    I'd like to know why can't you write queries with JavaScript? Normally you need create a Runtime Component by C#, ref: Creating Windows Runtime Components in C# and Visual Basic. Also you need to define the table by coding C# as below:

    public class Post
    {
        [PrimaryKey]
        public int Id { get; set; }
        public string Title { get; set; }
        public string Text { get; set; }
    }
    
    

    Include the C# Runtime Component in your WinJS, and use it. The CRUD operation is a kind of passing the parameter and execute it by C#. Read this for more information: Walkthrough: Creating a simple component in C# or Visual Basic and calling it from JavaScript

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Friday, December 27, 2013 12:13 PM
    Moderator
  • Thanks James,

              I can create db using sqlite-net.

             my application db queries having javascript callback functions.i'm not familiar with c# i don't know to how to write queries with call back functions .thanks for your support james i will learn it quickly

    Friday, December 27, 2013 12:25 PM
  • Hai James,

         Can i use both c# runtime component(sqlite-net) and c++ component(https://github.com/doo/SQLite3-WinRT  ) in same application.

    Tuesday, January 21, 2014 8:41 AM
  • Hi suganthe,

    Why not. Theoretically speaking its ok, but the SQLite access conflict might be a problem.

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Tuesday, January 21, 2014 9:52 AM
    Moderator