locked
Fetch file name from databse to a variable. RRS feed

  • Question

  • var records = dbcon.Table<databaseprograms>().Where(temp =>temp.ProgramChapter ==pageTitle.Text );

    my database consists of two columns, Chaptername and filename

    corresponding to this chapter i want to fetch the file name into a variable.

                                  
    Saturday, September 28, 2013 4:44 AM

Answers

  • Hi,

    Try to code like this below:

    var records = dbcon.Table<databaseprograms>().Where(temp =>temp.ProgramChapter ==pageTitle.Text );
    foreach (var sd in records ) 
    {
    string filename=sd.filename;//filename is the records property
    }

    And I suggest you can see this sample about how to use SQLite in windows 8:

    http://code.msdn.microsoft.com/windowsapps/Sqlite-For-Windows-8-Metro-2ec7a882/view/SourceCode#content

    Best Wishes!


    <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.

    • Marked as answer by Anne Jing Monday, October 7, 2013 2:13 AM
    Monday, September 30, 2013 7:54 AM

All replies

  • ????
    Saturday, September 28, 2013 9:48 AM
  • Try something like this

    var records = dbcon.Table<databaseprograms>()("select * from databaseprograms where ProgramChapter  = '" + pageTitle.Text + "'");

    Saturday, September 28, 2013 2:04 PM
  • Hi,

    Try to code like this below:

    var records = dbcon.Table<databaseprograms>().Where(temp =>temp.ProgramChapter ==pageTitle.Text );
    foreach (var sd in records ) 
    {
    string filename=sd.filename;//filename is the records property
    }

    And I suggest you can see this sample about how to use SQLite in windows 8:

    http://code.msdn.microsoft.com/windowsapps/Sqlite-For-Windows-8-Metro-2ec7a882/view/SourceCode#content

    Best Wishes!


    <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.

    • Marked as answer by Anne Jing Monday, October 7, 2013 2:13 AM
    Monday, September 30, 2013 7:54 AM