public void VideoPlayError(string YouTubeId, int ErrorCode)
        {
            //----------------------------------------------------------------------------------------------
            // Utilize Host Services for database processing:

            // Init the JimRadio host services class to get access to the JimRadio database
            // in server-side processing:
            jimRadioHostServices = new JimRadioHostServices();
            jimRadioHostServices.GetDatabaseSql(out sqlConnection, out sqlCommand);

            //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

            // Init the SQL:
            string strSqlQuery = "update video set play_error = " + ErrorCode.ToString() +
                                 " where youtube_id = '" + YouTubeId + "'";

            // Assign and execute the SQL:
            sqlCommand.CommandText = strSqlQuery;
            SqlDataReader sqlDataReader = sqlCommand.ExecuteReader();

            // Clean up:
            sqlConnection.Dispose();
            sqlCommand.Dispose();
            sqlDataReader.Dispose();
        }
Пример #2
0
    protected void Host_Services_Get_Database(out SqlConnection sqlConnection, out SqlCommand sqlCommand)
    {
        // Utilize Host Services for database processing.  Init the JimRadio host services class to
        // get access to the JimRadio database in server-side processing:
        JimRadioHostServices jimRadioHostServices = new JimRadioHostServices();

        jimRadioHostServices.GetDatabaseSql(out sqlConnection, out sqlCommand);
    }
        public string VideoLookupDemo(string YouTubeTitle)
        {
            //----------------------------------------------------------------------------------------------
            // Utilize Host Services for database processing:

            // Init the JimRadio host services class to get access to the JimRadio database
            // in server-side processing:
            jimRadioHostServices = new JimRadioHostServices();
            jimRadioHostServices.GetDatabaseSql(out sqlConnection, out sqlCommand);

            //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

            // Init the SQL:
            string strSqlQuery = "select count(*) from video where youtube_title like '%" + YouTubeTitle + "%'";
            int    intTitleCount;

            // Assign and execute the SQL:
            sqlCommand.CommandText = strSqlQuery;
            SqlDataReader sqlDataReader = sqlCommand.ExecuteReader();

            // Read the result:
            sqlDataReader.Read();
            intTitleCount = sqlDataReader.GetInt32(0);

            // Clean up:
            sqlConnection.Dispose();
            sqlCommand.Dispose();
            sqlDataReader.Dispose();

            // Return the appropriate message:
            if (intTitleCount > 0)
            {
                return("Video '" + YouTubeTitle + "' was found.");
            }
            else
            {
                return("Video '" + YouTubeTitle + "' was not found.");
            }
        }