Here is my code
Class 1
Dim strDescription As String 'str holding
desription of slide/doc
Dim strFinal As String 'holds formated
final string
Dim TF As New LSI()
Dim SL As New ApplyToStopList(cnn)
Dim MyQueue As New System.Collections.Queue()
'create description of slide/doc for reference
strDescription = MakeDescription(strData)
'prepare data for database entry
strFinal = SL.FormatFromStopList(TF.FormatForLSI(strData))
MsgBox(strFinal)
'make list of words in string and find hits
WordsInString(strFinal)
'get list of words in string
rdr = GetWords()
While (rdr.Read())
MyQueue.Enqueue(rdr(0))
MyQueue.Enqueue(rdr(1))
End While
rdr.Close()
Empty()
cnn.Dispose()
Dim DBA As New Class2()
Dim i As Integer = 0
Dim count As Integer = MyQueue.Count
While i < count
DBA.Add(MyQueue.Dequeue().ToString, path, author,
MyQueue.Dequeue().ToString, sn, strDescription, type)
i += 2
End While
DBA.Clear()
End Sub
End Class1
Class2
Private conn As System.Data.OleDb.OleDbConnection
Private cmd As System.Data.OleDb.OleDbCommand
Private rdr As System.Data.OleDb.OleDbDataReader
Public Sub New()
Me.conn = New System.Data.OleDb.OleDbConnection()
Me.conn.ConnectionString = "connectionstring"
Me.cmd = New System.Data.OleDb.OleDbCommand()
Me.cmd.Connection = Me.conn
MsgBox(conn.DataSource.ToString)
End Sub
Public Sub Add(ByVal strName As String, _
ByRef strPath As String, ByVal strAuthor As String, _
ByVal strHits As String, ByVal strSN As String, _
ByRef strDescription As String, ByVal strType As String)
'if strName is a Keyword in data
If Not (RemoveWhiteSpace(strName) = Nothing) Then
If Exists(strName) Then
'then just insert it into that table
Insert(strName, strPath, strAuthor, strHits, strSN,
strDescription, strType)
Else
'otherwise add it to the keywords and create a table for
it
AddKeyWord(strName)
AddTable(strName, strPath, strAuthor, strHits, strSN,
strDescription, strType)
End If
End If
Private Function Exists(ByVal str As String)
'connects to save pooled connection
'claims is null
MsgBox(conn.DataSource.ToString)
If Me.conn.State = ConnectionState.Closed Then
Me.conn.Open() 'faults here
End If
cmd.CommandText = "SELECT Keywords FROM keywords WHERE Keywords
= '" & str & "'"
rdr = cmd.ExecuteReader
If rdr.Read() Then
rdr.Close()
Return True
Else
rdr.Close()
Return False
End If
End Function
*** Sent via Developersdex
http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!