Beispiel #1
0
 private void InsertAuthorToDb(string author)
 {
     //MessageBox.Show("Need to add " + author);
     using (ODBCClass o = new ODBCClass(DSN))
     {
         OdbcCommand oCommand = o.GetCommand("INSERT INTO authors(author) VALUES('" + author + "')");
         oCommand.ExecuteNonQuery();
     }
     Log(author);
 }
Beispiel #2
0
        private void InsertTitleToDb(string title, int authorID)
        {
            //MessageBox.Show("Need to add " + author);
            string sSQL = "INSERT INTO storytapes(authorid,title,addeddt,seriesorder,filepath,id3tags) VALUES("
                          + authorID.ToString() + ",'" + title + "','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
                          + "',0,'" + title.Replace(" ", "_").ToLower() + "','N')";

            using (ODBCClass o = new ODBCClass(DSN))
            {
                OdbcCommand oCommand = o.GetCommand(sSQL);
                oCommand.ExecuteNonQuery();
            }
            //Log(sSQL);
        }
Beispiel #3
0
 private void SetTagsUpdated(string author, string album)
 {
     if (!firstRun)
     {
         album = album.Replace("'", "");
         using (ODBCClass o = new ODBCClass(DSN))
         {
             OdbcCommand oCommand = o.GetCommand("UPDATE storytapes SET"
                                                 + " id3tags='Y'"
                                                 + " WHERE title = '" + album + "'"
                                                 + " AND authorid=(SELECT id FROM `authors` WHERE author='" + author + "')");
             oCommand.ExecuteNonQuery();
         }
     }
 }
Beispiel #4
0
        private DataTable GetDBAuthors()
        {
            DataTable     dt = new DataTable();
            StringBuilder sb = new StringBuilder();

            using (ODBCClass o = new ODBCClass(DSN))
            {
                OdbcCommand    oCommand = o.GetCommand("SELECT * FROM authors");
                OdbcDataReader oReader  = oCommand.ExecuteReader();
                dt.Load(oReader);

                if (dt.Rows.Count > 0)
                {
                    foreach (DataRow row in dt.Rows)
                    {
                        sb.AppendLine(row["author"].ToString());
                    }
                }
                //tb.Text = sb.ToString();
                return(dt);
            }
        }
Beispiel #5
0
        public List <string> GetTitlesForAuthor(int authorID)
        {
            DataTable     dt = new DataTable();
            StringBuilder sb = new StringBuilder();

            List <string> titles = new List <string>();

            using (ODBCClass o = new ODBCClass(DSN))
            {
                OdbcCommand oCommand = o.GetCommand("SELECT title FROM storytapes"
                                                    + " WHERE authorid=" + authorID.ToString());
                OdbcDataReader oReader = oCommand.ExecuteReader();
                dt.Load(oReader);

                if (dt.Rows.Count > 0)
                {
                    foreach (DataRow row in dt.Rows)
                    {
                        titles.Add(row["title"].ToString());
                    }
                }
                return(titles);
            }
        }