Patrick E Collins 14.Mar.11 02:40 PM a Web browser Applications Development6.5.2Windows XP
Hello All -
I have had a script running successfully for the past 10 years between Notes and Sybase. Recently we started migrating the Sybase db to SQL.
I created a new ODBC Connection, and successfully tested it. Then I changed my connection string in the script to match the new ODBC settings.
I ran the script and received back a "LS:DO- ODBC could not complete the requested operation."
Then I changed all of the Character Strings from 34(") to 39(') and the script ran through, but brought back no results.
There are 56 groups that should be displayed, but instead I get back "False" for each group result when I msgboxed the qryGroup.
I have posted my code hoping that you may see something that is causing this?
Any help would be greatly appreciated
Thank you,
Patrick
Sub Initialize
' Dim the session and the Document
Dim con As New ODBCConnection
Dim qry As New ODBCQuery
Dim result As New ODBCResultSet
Dim qryGroup As New ODBCQuery
Dim resultGroup As New ODBCResultSet
Dim session As New NotesSession
Dim db As NotesDatabase
Dim view As NotesView
Dim doc As NotesDocument
Dim NextRecord As Integer
Dim NumSurvey As Integer
Dim RecordCount As Integer
Dim LastRecNum As Integer
Dim Loop1 As Integer
Dim Loop2 As Integer
Dim LoopGroup As Integer
Dim profsession As New NotesSession
Dim profdb As NotesDatabase
Dim profdoc As NotesDocument
Dim XID As Variant
Set profdb = profsession.CurrentDatabase
' Set the document to the profile form
Set profdoc = profdb.getprofiledocument("DB Profile")
' Set and Get the values of the ODBC User ID and Password
Set RemID = profdoc.GetFirstItem( "RemID")
Set RemPW = profdoc.GetFirstItem( "RemPW")
qry.SQL = qry.SQL + " SHR_PeopleGroup_vw.Last_Surveyed is null) and"
qry.SQL = qry.SQL + " (SHR_PeopleGroup_vw.Notes_Name is not null and"
qry.SQL = qry.SQL + " SHR_PeopleGroup_vw.Notes_Name <> " & Chr$(34) & "UNKNOWN" & Chr$(34) &" and"
qry.SQL = qry.SQL + " SHR_PeopleGroup_vw.Notes_Name <> " & Chr$(34) & "UNKN" & Chr$(34) &") and"
qry.SQL = qry.SQL + " (HPD_HelpDesk_VW.Import_Type <> " & Chr$(34) & "VIRUS ALERT" & Chr$(34) & " or"
qry.SQL = qry.SQL + " HPD_HelpDesk_VW.Import_Type is null)"
'qry.SQL = qry.SQL + " HPD_HelpDesk_VW.Import_Type <> " & Chr$(34) & "VIRUS ALERT" & Chr$(34)
' fileNumber% = Freefile
' Open "C:\BPFeedback.TXT" For Binary Access Write As fileNumber%
' Put fileNumber%, 1, qry.SQL
' Messagebox (qry.sql)
Set result.Query = qry
If Not result.Execute() Then
Messagebox ("After HPD Query!" & result.GetErrorMessage(DB_LASTERROR))
End If
Set db = session.CurrentDatabase
NumSurvey = resultGroup.GetValue(2)
Call Result.LastRow()
LastRecNum = result.NumRows
If LastRecNum <= NumSurvey Then
NumSurvey = LastRecNum
NextRecord = 1
Else
'Here is where we get an evenly distributes sample by dividing the total number of records by how many surveys we need.
NextRecord = Fix(LastRecNum/NumSurvey)
If NextRecord = 0 Then
NextRecord = 1
End If
End If
Call Result.FirstRow()
Set view = db.GetView("FCRView")
'Messagebox (lastrecnum)
For Loop1 = 1 To NumSurvey
' After any error-generating statement, resume
' execution with the next statement.
On Error Resume Next
'Here is where we will send the survey
%REM
Dim newDoc As NotesDocument
Dim rtitema As Variant
Dim rtitem As NotesRichTextItem
Set db = session.CurrentDatabase
Set newDoc = New NotesDocument( db )
Set rtitemA = profdoc.GetFirstItem( "ProfMailto")
Set rtitemB = profdoc.GetFirstItem( "ProfSelfHelpLink")
Set rtitem = New NotesRichTextItem( newDoc, "Body" )
newDoc.Form = "Memo"
'newDoc.SendTo = "Patrick E Collins/O&S/Prudential"
newDoc.SendTo = doc.email
If result.GetValue(6)="PSI" Then
newDoc.Principal = "Information Systems Group"
newDoc.Subject = "ISG Satisfaction Feedback"
Call rtitem.AppendText( "ISG is committed to providing world class support. Your opinion is very important. " & Chr(13) )
Call rtitem.AppendText( Chr(13) & "In order for our support analysts to improve the quality of services delivered to you, we are" )
Call rtitem.AppendText( Chr(13) & " asking that you please complete and return this feedback form." & Chr(13) )
Call rtitem.AppendText( Chr(13) & "Your immediate feedback will help us to gauge how well we have satisfied your needs and ")
Call rtitem.AppendText( Chr(13) & " to determine how we can better serve you in the future." & Chr(13) )
Call rtitem.AppendText( Chr(13) & "Thank you for taking the time to provide us with your feedback. We may contact you as part")
Call rtitem.AppendText( Chr(13) & " of our follow up process in order to implement improvements to our service delivery." & Chr(13) )
Call rtitem.AppendText( Chr(13) & "The information below briefly describes your closed Remedy ticket:" & Chr(13) )
Call rtitem.AppendText( Chr(13) &"Ticket #" & doc.TicketNumber(0) & " stating " & Chr(34) & doc.ShortDescription(0) & Chr(34) & Chr(13) )
Call rtitem.AppendText( Chr(13) &"Please click here to access your feedback form" & " =====> " )
Call rtitem.AppendDocLink( doc,"ISG Customer Satisfaction Feedback")
Call newDoc.Send( False )
End If
If result.GetValue(6)<>"PSI" Then
newDoc.Principal = "Global Business & Technology Solutions"
newDoc.Subject = "GBTS Satisfaction Feedback"
Call rtitem.AppendText( "GBTS is committed to providing world class support. Your opinion is very important. " & Chr(13) )
Call rtitem.AppendText( Chr(13) & "In order for our support analysts to improve the quality of services delivered to you, we are" )
Call rtitem.AppendText( Chr(13) & "asking that you please complete and return this feedback form. Your immediate response" )
Call rtitem.AppendText( Chr(13) & "will help us to gauge how well we have satisfied your needs and to determine how we can" )
Call rtitem.AppendText( Chr(13) & "better serve you in the future." & Chr(13) )
Call rtitem.AppendText( Chr(13) & "Thank you for taking the time to provide us with your feedback. We may contact you as part" )
Call rtitem.AppendText( Chr(13) & " of our follow up process in order to implement improvements to our service delivery." )
Call rtitem.AppendText( Chr(13) & "The information below briefly describes your closed Remedy ticket:" & Chr(13) )
Call rtitem.AppendText( Chr(13) &"Ticket #" & doc.TicketNumber(0) & " stating " & Chr(34) & doc.ShortDescription(0) & Chr(34) & Chr(13) )
Call rtitem.AppendText( Chr(13) &"Please click here to access your feedback form" & " =====> " )
Call rtitem.AppendDocLink( doc,"GBTS Customer Satisfaction Feedback" & Chr(13) )
Call rtitem.AddNewLine( 1 )
' Call rtitem.AppendText( Chr(13) & "Please direct questions/problems regarding the form only (not service feedback) to: ")
' Call rtitem.AppendRTItem( rtitemA )
' Call rtitem.AddNewLine( 1 )
Call rtitem.AppendText( Chr(13) & "***************************** DID YOU KNOW... CTM HAS A NEW WEB SITE! *****************************" )
Call rtitem.AppendText( Chr(13) & "You can find the solutions to many of your computer related issues and reset your LAN Password" )
Call rtitem.AppendText( Chr(13) & "by simply typing ")
Call rtitem.AppendRTItem( rtitemB )
Call rtitem.AppendText( " in your Internet Explorer Browser. From the CTMHELP" )
Call rtitem.AppendText( Chr(13) & "web site you can also reset your Mainframe and RACF passwords by simply answering a few ")
Call rtitem.AppendText( Chr(13) & "short questions. Current System Statuses are displayed right on the CTMHELP." & Chr(13))
Call rtitem.AppendText( Chr(13) & "Passwords can also be reset by using our automated phone system by calling 888-778-7789 and" )
Call rtitem.AppendText( Chr(13) & "choosing Option 1 for Password Resets. " )
Call rtitem.AppendDocLink( doc,"GBTS Customer Satisfaction Feedback")
Call newDoc.Send( False )
End If
%END REM
'Skip to next record wanted
For Loop2 = 1To nextrecord
Call result.Nextrow()
Next Loop2
Next Loop1
resultGroup.NextRow
Next LoopGroup
Else
Messagebox("Could not connect to server")
End If