Floetic Posted May 18, 2007 Share Posted May 18, 2007 Using Microsoft Visual Basic 6.0 Microsoft SQL Enterprise Manager 8.0 -- Form1.frm Option Explicit Private Sub cmdDone_Click() End End Sub Private Sub cmdLookUp_Click() If Trim(Text1.Text) <> "" Then Call GetStats Else MsgBox "Please enter a start date", vbExclamation End If If Trim(Text2.Text) <> "" Then Call GetStats Else MsgBox "Please enter an end date", vbExclamation End If End Sub Sub GetStats() Dim strSQL As String Dim rst As ADODB.Recordset strSQL = " CARLA_SEL '" & Text1.Text & "'" & Text2.Text & "'" Call ADO_Query(intCurrentConnection, strSQL, rst) lstInformation.Clear List1.Clear If rst.RecordCount > 0 Then Do While Not rst.EOF lstInformation.AddItem Trim(rst("SDATE")) & " " & Trim(rst("EDATE")) List1.AddItem Trim(rst("SDATE")) & " " & Trim(rst("EDATE")) rst.MoveNext Loop lstInformation.Visible = True Else MsgBox "No stats found for that date range" End If End Sub Private Sub Command1_Click() Call GetDetails End Sub Private Sub lstInformation_Click() Text1.Text = Trim(List1.List(lstInformation.ListIndex)) Text2.Text = Trim(List1.List(lstInformation.ListIndex)) Label3.Caption = List1.List(lstInformation.ListIndex) End Sub Private Sub lstInfo_Click() Text1.Text = (lstInformation.ListIndex + 1) & ". " & lstInformation.List(lstInformation.ListIndex) Text2.Text = (lstInformation.ListIndex + 1) & ". " & lstInformation.List(lstInformation.ListIndex) End Sub Sub GetDetails() Dim dateStartDate As Date Dim dateEndDate As Date Dim strSQL As String dateStartDate = Trim(Label3.Caption) dateStartDate = Trim(Text1.Text) dateEndDate = Trim(Text2.Text) strSQL = " CARLA_PROB1 '" & dateStartDate & "','" & dateEndDate & "','" Call ADO_Execute(intCurrentConnection, strSQL) End Sub Private Sub Form_Load() Top = 0 Left = 0 Height = 9000 Width = 12000 End Sub -- stored Procedure code; CARLA_SEL CREATE PROCEDURE CARLA_SEL as declare @startdate datetime, @enddate datetime begin select*from tblRequestMaster RM where RM.fldRequestDate=@startdate and RM.fldRequestDate=@enddate end GO --stored procedure code; CARLA_PROB1 CREATE PROCEDURE CARLA_PROB1 AS DECLARE @startdate datetime, @enddate datetime -- (1) Number of calls received for each priority of call [for a specified date range] select RM.fldPriorityCode as 'Priority', count(RM.fldRequestID) as 'Calls' from tblRequestMaster RM where RM.fldPriorityCode between 1 and 5 and RM.fldRequestDate between '' and '' and RM.fldRequestFlag like 'D' group by RM.fldPriorityCode union select 'Total' as 'Priority', count(RM.fldRequestID) as 'Calls' from tblRequestMaster RM where RM.fldPriorityCode between 1 and 5 and RM.fldRequestDate between '' and '' and RM.fldRequestFlag like 'D' order by RM.fldPriorityCode asc GO This is the code in my modules; --mod_ConnectionRoutines.bas Option Explicit ' '************************************************************************************ 'Module to house the MainConnection calls '************************************************************************************ ' Public Function ADO_Execute(intConn As Integer, _ strSQL) As Boolean Err.Clear On Error GoTo ErrHandle: 'set timeouts Call SetNewTimeouts ADO_Execute = True With clsConnectionObject Call .ADO_Execute(intConn, strSQL) End With 'reset timeouts Call ResetTimeouts Exit Function ErrHandle: Call ResetTimeouts ADO_Execute = False Err.Raise Err.Number End Function Public Function ADO_Query(intConn As Integer, _ strSQL As String, _ rst As ADODB.Recordset, _ Optional CursorType As ADODB.CursorTypeEnum, _ Optional LockType As ADODB.LockTypeEnum, _ Optional CursorLocation As ADODB.CursorLocationEnum) As Boolean Err.Clear On Error GoTo ErrHandle: 'set timeouts Call SetNewTimeouts ADO_Query = True With clsConnectionObject Call .ADO_Query(intConn, strSQL, rst, CursorType, LockType, CursorLocation) End With 'reset timeouts Call ResetTimeouts Exit Function ErrHandle: Call ResetTimeouts ADO_Query = False Err.Raise Err.Number End Function Public Function ADO_Recordset(intConn As Integer, _ ByVal strSQL As String, _ Optional CursorType As ADODB.CursorTypeEnum, _ Optional LockType As ADODB.LockTypeEnum, _ Optional CursorLocation As ADODB.CursorLocationEnum) As ADODB.Recordset Err.Clear On Error GoTo ErrHandle: 'set timeouts Call SetNewTimeouts With clsConnectionObject Set ADO_Recordset = .ADO_Recordset(intConn, strSQL, CursorType, LockType, CursorLocation) End With 'reset timeouts Call ResetTimeouts Exit Function ErrHandle: Call ResetTimeouts Err.Raise Err.Number End Function Sub SetNewTimeouts() 'routine to set the Component Request timeouts to 1 hour App.OleRequestPendingTimeout = 3600000 App.OleServerBusyTimeout = 3600000 End Sub Sub ResetTimeouts() 'routine to reset the Component Request timeouts App.OleRequestPendingTimeout = 10000 App.OleServerBusyTimeout = 10000 End Sub --modMainConnect.bas Option Explicit 'global variables for MainConnection Public gstrDSN As String Public gstrDBase As String Public gstrUser As String Public gstrPassword As String 'array of all current DB connections Public strConnections(10, 4) As String Public intCurrentConnections(10) As Integer Public intTotalConnections As Integer 'New global connection object for BOIS Public clsConnectionObject As MainConnection.clsMainConnection Public intCurrentConnection As Integer Public blnConnectionCompleted As Boolean Function ConnectToServer(strDataSource As String, _ strUsername As String, _ strPassword As String, _ strDBname As String) As Boolean '********************************************************* 'Create an instance of ConnectionObject Set clsConnectionObject = New clsMainConnection '********************************************************* On Error GoTo ErrorHandle 'now establish Connection to server database Call clsConnectionObject.ConnectToDB(Trim(strDataSource), Trim(strDBname), Trim(strUsername), Trim(strPassword)) ConnectToServer = True gstrUser = strUsername intCurrentConnection = clsConnectionObject.intConnection Exit Function ErrorHandle: ConnectToServer = False Err.Clear End Function --Module1.bas Option Explicit Sub Main() If ConnectToServer("BOISSQL", "itd", "2002", "BOIS") Then Form1.Show Else MsgBox "Unsuccessful :::: Unable To Connect" & Err.Description End If End Sub When I try to run the VB code I get the following error; 'Compile Error: User-defined type not defined' Can anyone tell me were I am going wrong? Thx ~ Floetic ~ Quote Link to comment https://forums.phpfreaks.com/topic/51977-complie-error/ Share on other sites More sharing options...
trq Posted May 19, 2007 Share Posted May 19, 2007 I know nothing of (nor do I want to) VB, but surely, those stored procedures need to be strings or something. They look very out of place. Quote Link to comment https://forums.phpfreaks.com/topic/51977-complie-error/#findComment-256753 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.