Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old May 18th, 2007, 05:40 AM
Floetic Floetic is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: May 2007
Location: Belfast, N.I
Posts: 8 Floetic User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 41 m 22 sec
Reputation Power: 0
Send a message via MSN to Floetic
Complie Error

Code:
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 ~

Reply With Quote
  #2  
Old May 18th, 2007, 12:10 PM
chapman10s's Avatar
chapman10s chapman10s is offline
**Wanted Wizard**
ASP Free God (5000 - 5499 posts)
 
Join Date: Apr 2006
Location: Who knows...
Posts: 5,410 chapman10s User rank is General 5th Grade (Above 100000 Reputation Level)chapman10s User rank is General 5th Grade (Above 100000 Reputation Level)chapman10s User rank is General 5th Grade (Above 100000 Reputation Level)chapman10s User rank is General 5th Grade (Above 100000 Reputation Level)chapman10s User rank is General 5th Grade (Above 100000 Reputation Level)chapman10s User rank is General 5th Grade (Above 100000 Reputation Level)chapman10s User rank is General 5th Grade (Above 100000 Reputation Level)chapman10s User rank is General 5th Grade (Above 100000 Reputation Level)chapman10s User rank is General 5th Grade (Above 100000 Reputation Level)chapman10s User rank is General 5th Grade (Above 100000 Reputation Level)chapman10s User rank is General 5th Grade (Above 100000 Reputation Level)chapman10s User rank is General 5th Grade (Above 100000 Reputation Level)chapman10s User rank is General 5th Grade (Above 100000 Reputation Level)chapman10s User rank is General 5th Grade (Above 100000 Reputation Level)chapman10s User rank is General 5th Grade (Above 100000 Reputation Level)chapman10s User rank is General 5th Grade (Above 100000 Reputation Level)  Folding Points: 12139 Folding Title: Novice Folder
Time spent in forums: 3 Weeks 4 Days 12 h 36 m
Reputation Power: 1331
Send a message via AIM to chapman10s Send a message via MSN to chapman10s
what db are you running? sql server?
__________________
I would rather know than not know at all...



Reply With Quote
  #3  
Old May 18th, 2007, 02:51 PM
Lauramc's Avatar
Lauramc Lauramc is offline
SQL Slarentice
ASP Free Intermediate (1500 - 1999 posts)
 
Join Date: Nov 2004
Location: In My Happy Place
Posts: 1,810 Lauramc User rank is General 3rd Grade (Above 100000 Reputation Level)Lauramc User rank is General 3rd Grade (Above 100000 Reputation Level)Lauramc User rank is General 3rd Grade (Above 100000 Reputation Level)Lauramc User rank is General 3rd Grade (Above 100000 Reputation Level)Lauramc User rank is General 3rd Grade (Above 100000 Reputation Level)Lauramc User rank is General 3rd Grade (Above 100000 Reputation Level)Lauramc User rank is General 3rd Grade (Above 100000 Reputation Level)Lauramc User rank is General 3rd Grade (Above 100000 Reputation Level)Lauramc User rank is General 3rd Grade (Above 100000 Reputation Level)Lauramc User rank is General 3rd Grade (Above 100000 Reputation Level)Lauramc User rank is General 3rd Grade (Above 100000 Reputation Level)Lauramc User rank is General 3rd Grade (Above 100000 Reputation Level)Lauramc User rank is General 3rd Grade (Above 100000 Reputation Level)Lauramc User rank is General 3rd Grade (Above 100000 Reputation Level)Lauramc User rank is General 3rd Grade (Above 100000 Reputation Level)Lauramc User rank is General 3rd Grade (Above 100000 Reputation Level) 
Time spent in forums: 2 Weeks 1 Day 20 h 24 m 30 sec
Reputation Power: 1143
I did not review all the code, but this line is suspicious...
Code:
DECLARE 
@startdate datetime, 
try chaging it to:
Code:
 DECLARE @StartDate datetime DECLARE @EndDate datetime 


Edit - while it does work to declare on the same line, it might be a good idea to change it anyway. Can you post the line on which you get the error?

Last edited by Lauramc : May 18th, 2007 at 02:56 PM.

Reply With Quote
  #4  
Old May 20th, 2007, 10:58 AM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is offline
Moderator From Beyond
ASP Free God 46th Plane (27500 - 27999 posts)
 
Join Date: Sep 2004
Location: Israel
Posts: 27,932 Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)  Folding Points: 391471 Folding Title: Super Ultimate Folder - Level 1Folding Points: 391471 Folding Title: Super Ultimate Folder - Level 1Folding Points: 391471 Folding Title: Super Ultimate Folder - Level 1Folding Points: 391471 Folding Title: Super Ultimate Folder - Level 1Folding Points: 391471 Folding Title: Super Ultimate Folder - Level 1Folding Points: 391471 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 2 Weeks 12 h 17 m 53 sec
Reputation Power: 2002
what line generates this error message?

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingVisual Basic Programming > Complie Error


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump



 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT