} //AlphabetSequenceDatabaseQuery() /// <summary>The database query.</summary> /// <param name="databaseConnectionString">The database connection string.</param> /// <param name="exceptionMessage">The exception message.</param> /// <param name="wordQuery">The word.</param> /// <param name="scriptureReferenceAssociates">The scripture reference associates.</param> /// <param name="alphabetSequenceIndex">The alphabet sequence index.</param> /// <param name="scriptureReferenceAlphabetSequence">The scripture reference alphabet sequence.</param> public static void AlphabetSequenceQuery ( ref String databaseConnectionString, ref String exceptionMessage, ref String[] wordQuery, String scriptureReferenceAssociates, ref int[] alphabetSequenceIndex, ref ScriptureReferenceAlphabetSequence[] scriptureReferenceAlphabetSequence ) { int sequenceOrderId = -1; int theWordId = -1; int wordQueryTotal = wordQuery.Length; string chapterForward = null; string chapterBackward = null; //string commentary = null; string scriptureReference = null; string scriptureReferenceChapterBackward = null; string scriptureReferenceChapterForward = null; string scriptureReferenceVerseBackward = null; string scriptureReferenceVerseForward = null; string verseForward = null; string verseBackward = null; OleDbConnection oleDbConnection = null; OleDbCommand oleDbCommand = null; OleDbDataReader oleDbDataReader = null; OleDbParameter oleDbParameterWord = null; OleDbParameter oleDbParameterScriptureReferenceAssociates = null; OleDbParameter oleDbParameterAlphabetSequence = null; OleDbParameter oleDbParameterScriptureReferenceVerseForward = null; OleDbParameter oleDbParameterScriptureReferenceChapterForward = null; OleDbParameter oleDbParameterScriptureReferenceChapterBackward = null; OleDbParameter oleDbParameterScriptureReferenceVerseBackward = null; OleDbParameter oleDbParameterScriptureReference = null; OleDbParameter oleDbParameterSequenceOrderId = null; OleDbParameter oleDbParameterVerseForward = null; OleDbParameter oleDbParameterChapterForward = null; OleDbParameter oleDbParameterChapterBackward = null; OleDbParameter oleDbParameterVerseBackward = null; OleDbParameter oleDbParameterCommentary = null; OleDbParameter oleDbParameterTheWordId = null; AlphabetSequenceIndexCalculate ( ref wordQuery, ref alphabetSequenceIndex ); try { if ( databaseConnectionString == null || databaseConnectionString.IndexOf("Bible") < 0 ) { databaseConnectionString = DatabaseConnectionString; }//if ( databaseConnectionString == null ) oleDbConnection = UtilityDatabase.DatabaseConnectionInitialize ( databaseConnectionString, ref exceptionMessage ); if (oleDbConnection == null || exceptionMessage != null) { return; }//if ( oleDbConnection == null || exceptionMessage != null ) oleDbCommand = new OleDbCommand(SQLSelectAlphabetSequence, oleDbConnection); oleDbCommand.CommandType = CommandType.StoredProcedure; oleDbParameterWord = new OleDbParameter(ParameterWord, OleDbType.VarChar, DatabaseOutputParameterSize); oleDbParameterScriptureReferenceAssociates = new OleDbParameter(ParameterWord, OleDbType.VarChar, DatabaseOutputParameterSize); oleDbParameterAlphabetSequence = new OleDbParameter(ParameterAlphabetSequence, OleDbType.Integer); oleDbParameterScriptureReferenceVerseForward = new OleDbParameter(ParameterScriptureReferenceVerseForward, OleDbType.VarChar, DatabaseOutputParameterSize); oleDbParameterScriptureReferenceChapterForward = new OleDbParameter(ParameterScriptureReferenceChapterForward, OleDbType.VarChar, DatabaseOutputParameterSize); oleDbParameterScriptureReferenceChapterBackward = new OleDbParameter(ParameterScriptureReferenceChapterBackward, OleDbType.VarChar, DatabaseOutputParameterSize); oleDbParameterScriptureReferenceVerseBackward = new OleDbParameter(ParameterScriptureReferenceVerseBackward, OleDbType.VarChar, DatabaseOutputParameterSize); oleDbParameterScriptureReference = new OleDbParameter(ParameterScriptureReference, OleDbType.VarChar, DatabaseOutputParameterSize); oleDbParameterVerseForward = new OleDbParameter(ParameterVerseForward, OleDbType.VarChar, DatabaseOutputParameterSize); oleDbParameterChapterForward = new OleDbParameter(ParameterChapterForward, OleDbType.VarChar, DatabaseOutputParameterSize); oleDbParameterChapterBackward = new OleDbParameter(ParameterChapterBackward, OleDbType.VarChar, DatabaseOutputParameterSize); oleDbParameterVerseBackward = new OleDbParameter(ParameterVerseBackward, OleDbType.VarChar, DatabaseOutputParameterSize); oleDbParameterSequenceOrderId = new OleDbParameter(ParameterSequenceOrderId, OleDbType.Integer); oleDbParameterCommentary = new OleDbParameter(ParameterCommentary, OleDbType.VarChar, DatabaseOutputParameterSize); oleDbParameterTheWordId = new OleDbParameter(ParameterTheWordId, OleDbType.Integer); oleDbParameterSequenceOrderId = new OleDbParameter(ParameterSequenceOrderId, OleDbType.Integer); /* * @word VARCHAR(600) = NULL OUTPUT, * @scriptureReferenceAssociates VARCHAR(600) = NULL OUTPUT, * @alphabetSequence INT = -1 OUTPUT, * @scriptureReferenceVerseForward VARCHAR(600) = NULL OUTPUT, * @scriptureReferenceChapterForward VARCHAR(600) = NULL OUTPUT, * @scriptureReferenceChapterBackward VARCHAR(600) = NULL OUTPUT, * @scriptureReferenceVerseBackward VARCHAR(600) = NULL OUTPUT, * @scriptureReference VARCHAR(600) = NULL OUTPUT, * @verseForward VARCHAR(600) = NULL OUTPUT, * @chapterForward VARCHAR(600) = NULL OUTPUT, * @chapterBackward VARCHAR(600) = NULL OUTPUT, * @verseBackward VARCHAR(600) = NULL OUTPUT, * @sequenceOrderId INT = -1 OUTPUT */ oleDbCommand.Parameters.Add(oleDbParameterWord); oleDbCommand.Parameters.Add(oleDbParameterScriptureReferenceAssociates); oleDbCommand.Parameters.Add(oleDbParameterAlphabetSequence); oleDbCommand.Parameters.Add(oleDbParameterScriptureReferenceVerseForward); oleDbCommand.Parameters.Add(oleDbParameterScriptureReferenceChapterForward); oleDbCommand.Parameters.Add(oleDbParameterScriptureReferenceChapterBackward); oleDbCommand.Parameters.Add(oleDbParameterScriptureReferenceVerseBackward); oleDbCommand.Parameters.Add(oleDbParameterScriptureReference); oleDbCommand.Parameters.Add(oleDbParameterVerseForward); oleDbCommand.Parameters.Add(oleDbParameterChapterForward); oleDbCommand.Parameters.Add(oleDbParameterChapterBackward); oleDbCommand.Parameters.Add(oleDbParameterVerseBackward); /* * oleDbCommand.Parameters.Add(oleDbParameterCommentary); * oleDbCommand.Parameters.Add(oleDbParameterTheWordId); */ oleDbCommand.Parameters.Add(oleDbParameterSequenceOrderId); oleDbParameterWord.Direction = ParameterDirection.InputOutput; oleDbParameterScriptureReferenceAssociates.Direction = ParameterDirection.InputOutput; oleDbParameterAlphabetSequence.Direction = ParameterDirection.InputOutput; oleDbParameterScriptureReferenceVerseForward.Direction = ParameterDirection.Output; oleDbParameterScriptureReferenceChapterForward.Direction = ParameterDirection.Output; oleDbParameterScriptureReferenceChapterBackward.Direction = ParameterDirection.Output; oleDbParameterScriptureReferenceVerseBackward.Direction = ParameterDirection.Output; oleDbParameterScriptureReference.Direction = ParameterDirection.Output; oleDbParameterVerseForward.Direction = ParameterDirection.Output; oleDbParameterChapterForward.Direction = ParameterDirection.Output; oleDbParameterChapterBackward.Direction = ParameterDirection.Output; oleDbParameterVerseBackward.Direction = ParameterDirection.Output; /* * oleDbParameterCommentary.Direction = ParameterDirection.InputOutput; * oleDbParameterTheWordId.Direction = ParameterDirection.InputOutput; */ oleDbParameterSequenceOrderId.Direction = ParameterDirection.InputOutput; for (int wordQueryIndex = 0; wordQueryIndex < wordQuery.Length; ++wordQueryIndex) { oleDbParameterAlphabetSequence.Value = alphabetSequenceIndex[wordQueryIndex]; oleDbParameterScriptureReferenceAssociates.Value = scriptureReferenceAssociates; oleDbParameterSequenceOrderId.Value = -1; oleDbParameterTheWordId.Value = null; oleDbParameterWord.Value = wordQuery[wordQueryIndex]; oleDbCommand.ExecuteScalar(); scriptureReferenceVerseForward = (oleDbParameterScriptureReferenceVerseForward.Value).ToString(); scriptureReferenceChapterForward = (oleDbParameterScriptureReferenceChapterForward.Value).ToString(); scriptureReferenceChapterBackward = (oleDbParameterScriptureReferenceChapterBackward.Value).ToString(); scriptureReferenceVerseBackward = (oleDbParameterScriptureReferenceVerseBackward.Value).ToString(); scriptureReference = (oleDbParameterScriptureReference.Value).ToString(); verseForward = (oleDbParameterVerseForward.Value).ToString(); chapterForward = (oleDbParameterChapterForward.Value).ToString(); chapterBackward = (oleDbParameterChapterBackward.Value).ToString(); verseBackward = (oleDbParameterVerseBackward.Value).ToString(); sequenceOrderId = Int32.Parse(oleDbParameterSequenceOrderId.Value.ToString()); /* * theWordId = Int32.Parse ( oleDbParameterTheWordId.Value.ToString() ); */ scriptureReferenceAlphabetSequence[wordQueryIndex] = new ScriptureReferenceAlphabetSequence ( wordQuery[wordQueryIndex], scriptureReferenceAssociates, alphabetSequenceIndex[wordQueryIndex], scriptureReferenceVerseForward, scriptureReferenceChapterForward, scriptureReferenceChapterBackward, scriptureReferenceVerseBackward, scriptureReference, verseForward, chapterForward, chapterBackward, verseBackward, sequenceOrderId ); #if (DEBUG) System.Console.WriteLine("SequenceOrderId: {0}", sequenceOrderId); System.Console.WriteLine("TheWordId: {0}", theWordId); #endif } //for ( int wordQueryIndex = 0; wordQueryIndex < wordQueryTotal; ++wordQueryIndex ) } //try catch (OleDbException exception) { exceptionMessage = UtilityDatabase.DisplayOleDbErrorCollection(exception); System.Console.WriteLine("OleDbException: {0}", exceptionMessage); System.Console.WriteLine("OleDbException: {0}", oleDbParameterAlphabetSequence.Value); return; }//catch (OleDbException exception) catch (Exception exception) { exceptionMessage = exception.Message; System.Console.WriteLine("Exception: {0}", exception.Message); return; }//catch (Exception exception) finally { if (oleDbDataReader != null) { oleDbDataReader.Close(); } UtilityDatabase.DatabaseConnectionHouseKeeping ( oleDbConnection, ref exceptionMessage ); } //finally return; } //AlphabetSequenceQuery()
}//public static void DatabaseQuery() /// <summary>The database query.</summary> /// <param name="databaseConnectionString">The database connection string.</param> /// <param name="exceptionMessage">The exception message.</param> /// <param name="word">The word.</param> /// <param name="scriptureReferenceAssociates">The scripture reference associates.</param> /// <param name="alphabetSequence">The alphabet sequence.</param> /// <param name="scriptureReferenceAlphabetSequence">The scripture reference alphabet sequence.</param> public static void DatabaseQuery ( ref string databaseConnectionString, ref string exceptionMessage, string[] word, string scriptureReferenceAssociates, ref int[] alphabetSequence, ref ScriptureReferenceAlphabetSequence[] scriptureReferenceAlphabetSequence ) { int wordTotal = word.Length; string chapterForward = null; string chapterBackward = null; string scriptureReference = null; string scriptureReferenceChapterBackward = null; string scriptureReferenceChapterForward = null; string scriptureReferenceVerseBackward = null; string scriptureReferenceVerseForward = null; string verseForward = null; string verseBackward = null; OleDbConnection oleDbConnection = null; OleDbCommand oleDbCommand = null; OleDbDataReader oleDbDataReader = null; OleDbParameter oleDbParameterWord = null; OleDbParameter oleDbParameterScriptureReferenceAssociates = null; OleDbParameter oleDbParameterAlphabetSequence = null; OleDbParameter oleDbParameterScriptureReferenceVerseForward = null; OleDbParameter oleDbParameterScriptureReferenceChapterForward = null; OleDbParameter oleDbParameterScriptureReferenceChapterBackward = null; OleDbParameter oleDbParameterScriptureReferenceVerseBackward = null; OleDbParameter oleDbParameterScriptureReference = null; OleDbParameter oleDbParameterVerseForward = null; OleDbParameter oleDbParameterChapterForward = null; OleDbParameter oleDbParameterChapterBackward = null; OleDbParameter oleDbParameterVerseBackward = null; AlphabetSequenceIndexCalculate ( ref word, ref alphabetSequence ); try { if (databaseConnectionString == null) { databaseConnectionString = DatabaseConnectionString; }//if ( databaseConnectionString == null ) oleDbConnection = UtilityDatabase.DatabaseConnectionInitialize ( databaseConnectionString, ref exceptionMessage ); if (oleDbConnection == null || exceptionMessage != null) { return; }//if ( oleDbConnection == null || exceptionMessage != null ) oleDbCommand = new OleDbCommand(SQLSelectAlphabetSequence, oleDbConnection); oleDbCommand.CommandType = CommandType.StoredProcedure; oleDbParameterWord = new OleDbParameter(ParameterWord, OleDbType.VarChar, DatabaseOutputParameterSize); oleDbParameterScriptureReferenceAssociates = new OleDbParameter(ParameterWord, OleDbType.VarChar, DatabaseOutputParameterSize); oleDbParameterAlphabetSequence = new OleDbParameter(ParameterAlphabetSequence, OleDbType.Integer); oleDbParameterScriptureReferenceVerseForward = new OleDbParameter(ParameterScriptureReferenceVerseForward, OleDbType.VarChar, DatabaseOutputParameterSize); oleDbParameterScriptureReferenceChapterForward = new OleDbParameter(ParameterScriptureReferenceChapterForward, OleDbType.VarChar, DatabaseOutputParameterSize); oleDbParameterScriptureReferenceChapterBackward = new OleDbParameter(ParameterScriptureReferenceChapterBackward, OleDbType.VarChar, DatabaseOutputParameterSize); oleDbParameterScriptureReferenceVerseBackward = new OleDbParameter(ParameterScriptureReferenceVerseBackward, OleDbType.VarChar, DatabaseOutputParameterSize); oleDbParameterScriptureReference = new OleDbParameter(ParameterScriptureReference, OleDbType.VarChar, DatabaseOutputParameterSize); oleDbParameterVerseForward = new OleDbParameter(ParameterVerseForward, OleDbType.VarChar, DatabaseOutputParameterSize); oleDbParameterChapterForward = new OleDbParameter(ParameterChapterForward, OleDbType.VarChar, DatabaseOutputParameterSize); oleDbParameterChapterBackward = new OleDbParameter(ParameterChapterBackward, OleDbType.VarChar, DatabaseOutputParameterSize); oleDbParameterVerseBackward = new OleDbParameter(ParameterVerseBackward, OleDbType.VarChar, DatabaseOutputParameterSize); oleDbCommand.Parameters.Add(oleDbParameterWord); oleDbCommand.Parameters.Add(oleDbParameterScriptureReferenceAssociates); oleDbCommand.Parameters.Add(oleDbParameterAlphabetSequence); oleDbCommand.Parameters.Add(oleDbParameterScriptureReferenceVerseForward); oleDbCommand.Parameters.Add(oleDbParameterScriptureReferenceChapterForward); oleDbCommand.Parameters.Add(oleDbParameterScriptureReferenceChapterBackward); oleDbCommand.Parameters.Add(oleDbParameterScriptureReferenceVerseBackward); oleDbCommand.Parameters.Add(oleDbParameterScriptureReference); oleDbCommand.Parameters.Add(oleDbParameterVerseForward); oleDbCommand.Parameters.Add(oleDbParameterChapterForward); oleDbCommand.Parameters.Add(oleDbParameterChapterBackward); oleDbCommand.Parameters.Add(oleDbParameterVerseBackward); oleDbParameterWord.Direction = ParameterDirection.InputOutput; oleDbParameterScriptureReferenceAssociates.Direction = ParameterDirection.InputOutput; oleDbParameterAlphabetSequence.Direction = ParameterDirection.InputOutput; oleDbParameterScriptureReferenceVerseForward.Direction = ParameterDirection.Output; oleDbParameterScriptureReferenceChapterForward.Direction = ParameterDirection.Output; oleDbParameterScriptureReferenceChapterBackward.Direction = ParameterDirection.Output; oleDbParameterScriptureReferenceVerseBackward.Direction = ParameterDirection.Output; oleDbParameterScriptureReference.Direction = ParameterDirection.Output; oleDbParameterVerseForward.Direction = ParameterDirection.Output; oleDbParameterChapterForward.Direction = ParameterDirection.Output; oleDbParameterChapterBackward.Direction = ParameterDirection.Output; oleDbParameterVerseBackward.Direction = ParameterDirection.Output; for (int wordCount = 0; wordCount < wordTotal; ++wordCount) { oleDbParameterWord.Value = word[wordCount]; oleDbParameterScriptureReferenceAssociates.Value = scriptureReferenceAssociates; oleDbParameterAlphabetSequence.Value = alphabetSequence[wordCount]; oleDbCommand.ExecuteScalar(); scriptureReferenceVerseForward = (oleDbParameterScriptureReferenceVerseForward.Value).ToString(); scriptureReferenceChapterForward = (oleDbParameterScriptureReferenceChapterForward.Value).ToString(); scriptureReferenceChapterBackward = (oleDbParameterScriptureReferenceChapterBackward.Value).ToString(); scriptureReferenceVerseBackward = (oleDbParameterScriptureReferenceVerseBackward.Value).ToString(); scriptureReference = (oleDbParameterScriptureReference.Value).ToString(); verseForward = (oleDbParameterVerseForward.Value).ToString(); chapterForward = (oleDbParameterChapterForward.Value).ToString(); chapterBackward = (oleDbParameterChapterBackward.Value).ToString(); verseBackward = (oleDbParameterVerseBackward.Value).ToString(); scriptureReferenceAlphabetSequence[wordCount] = new ScriptureReferenceAlphabetSequence ( word[wordCount], scriptureReferenceAssociates, alphabetSequence[wordCount], scriptureReferenceVerseForward, scriptureReferenceChapterForward, scriptureReferenceChapterBackward, scriptureReferenceVerseBackward, scriptureReference, verseForward, chapterForward, chapterBackward, verseBackward ); return; } //for ( int wordCount = 0; wordCount < word.Length; ++wordCount ) } //try catch (OleDbException exception) { exceptionMessage = UtilityDatabase.DisplayOleDbErrorCollection(exception); System.Console.WriteLine("OleDbException: {0}", exceptionMessage); System.Console.WriteLine("OleDbException: {0}", oleDbParameterAlphabetSequence.Value); return; }//catch (OleDbException exception) catch (Exception exception) { exceptionMessage = exception.Message; System.Console.WriteLine("Exception: {0}", exception.Message); return; }//catch (Exception exception) finally { if (oleDbDataReader != null) { oleDbDataReader.Close(); } UtilityDatabase.DatabaseConnectionHouseKeeping ( oleDbConnection, ref exceptionMessage ); } //finally return; } //AlphabetSequenceDatabaseQuery()