Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 3 of 3

Thread: Help With Sql

  1. #1
    Join Date
    Mar 2006
    Location
    Corpus Christi, Texas
    Posts
    132

    Help With Sql

    I'm very new to Autoplay and I was working with a SQL database and I used this snip from another app but I’m trying to find out how to make it pick up and list all records (rows) that have the entryid (?) or lets say (1) I know I have to change what’s in red and add some but I can't seem to get it working. If you can help please explain so I may learn.
    Thanks


    function DisplayMoreNotes (nRecordNotes)
    -- initialize local variables
    local err = 0;
    local sEntryID = "";
    local sNotes = "";
    local sQuery = "";
    local tbResults = {};
    local nRow = 0;


    -- remove all items from the listbox.
    ListBox.DeleteItem("InputMoreNotes", -1);

    -- open the database
    OpenDatabase();

    -- Query DB table for results matching provided criteria
    sQuery = "SELECT * from TimeDate WHERE (entryid="..nRecordNotes..")";
    tbResults = SQLite.QueryToTable(db, sQuery);
    -- check query results
    err = CheckError("DisplayNotes(): DB Query");

    -- continue only if there was no error
    if err == 0 then

    -- since we are only dealing with one record (unique key), there will only be one row returned.
    nRow = 1;


    -- gather all data
    sDate = tbResults.Data[nRow]["Date"]

    -- display all data to the user
    ListBox.AddItem("InputMoreNotes", tbResults.Data[nRow]["Date"]);




    -- select the displayed record in the listbox, if it isn't selected already
    SelectMoreNoteItem(nRecordNotes);
    end

    -- Close the Database
    CloseDatabase();
    end

  2. #2
    Join Date
    Sep 2002
    Location
    Sol 3
    Posts
    3,160
    Try this

    Code:
    function DisplayMoreNotes (nRecordNotes)
    -- initialize local variables
    local err = 0;
    local sEntryID = "";
    local sNotes = "";
    local sQuery = "";
    local tbResults = {};
    local nRow = 0;
    
    
    -- remove all items from the listbox.
    ListBox.DeleteItem("InputMoreNotes", -1);
    
    -- open the database
    OpenDatabase();
    
    -- Query DB table for results matching provided criteria
    sQuery = "SELECT * from TimeDate WHERE (entryid="..nRecordNotes..")";
    tbResults = SQLite.QueryToTable(db, sQuery);
    -- check query results
    err = CheckError("DisplayNotes(): DB Query");
    
    -- continue only if there was no error
    if err == 0 then
    
    -- Use a for loop to step through al the records returned.
    for nRow = 1,tbResults.Rows do
    
    -- gather all data
    sDate = tbResults.Data[nRow]["Date"]
    
    -- display all data to the user
    ListBox.AddItem("InputMoreNotes", tbResults.Data[nRow]["Date"]);
    end
    
    -- select the displayed record in the listbox, if it isn't selected already
    SelectMoreNoteItem(nRecordNotes);
    end
    
    -- Close the Database
    CloseDatabase();
    end
    Tigg
    TJ-Tigger
    "A common mistake that people make when trying to design something completely foolproof was to underestimate the ingenuity of complete fools."
    "Draco dormiens nunquam titillandus."
    Map of IR Forum Users - IR Project CodeViewer - Online Help - TiggTV - QuizEngine

  3. #3
    Join Date
    Mar 2006
    Location
    Corpus Christi, Texas
    Posts
    132
    TJ-Tigger

    Thanks that worked!

    I would have sent to project but I’m embarrassed about how I learn to code seeing how other people code (To many -- )


    Hey
    I have anther really big problem but I’m trying to get it but it don't look good LOL

    Thanks again.

Similar Threads

  1. Microsoft SQL Server 2005 Express Edition
    By linuxbox in forum Setup Factory 7.0
    Replies: 0
    Last Post: 12-25-2005, 07:55 PM
  2. SQL - Easy does it
    By Intrigued in forum AutoPlay Media Studio 5.0
    Replies: 0
    Last Post: 08-22-2004, 09:48 PM
  3. selecting sql server
    By necabettin in forum Setup Factory 6.0
    Replies: 1
    Last Post: 05-13-2004, 09:20 PM
  4. MS SQL Server 7.0 Installs
    By swdevlin in forum Setup Factory 6.0
    Replies: 3
    Last Post: 06-10-2003, 01:51 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts