473,385 Members | 1,518 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

InvalidOperationException was unhandled

lotus18
866 512MB
Expand|Select|Wrap|Line Numbers
  1. Private Data As OleDbDataReader
  2. Private Command As New OleDbCommand
  3.  
  4. Friend Function Conflict(ByVal DayID As String, ByVal Room As String, ByVal _
  5.  NewTimeStarted As Date, ByVal NewTimeFinished As Date, ByVal SectionUnit As String, _
  6.   ByVal Semester As String) As Boolean
  7.         'Dim SectionUnit As String
  8.         'SectionUnit = Course & " " & Section
  9.         'Conflict = False 'Default Value
  10.  
  11.  
  12.         Main.SetConnection() 'Set Database Connection
  13.  
  14.         'PHASE 1 | CHECK ROOM SCHEDULES
  15.         Command = New OleDbCommand("Select * From LoadSchedules Where Rooms.Title='" & Room & _
  16.        "' And Not Rooms.Title='Field' And Semester='" & Semester & "' And DayID='" _
  17.        & DayID & "'", dbConnection)
  18.         Command.CommandType = CommandType.Text
  19.         Data = Command.ExecuteReader
  20.  
  21.         If (Data("TimeStarted") >= NewTimeStarted) And (Data("TimeStarted") < NewTimeFinished) Then
  22.             Conflict = True
  23.             'MsgBox "1 | Conflict sa 1st day. May nakaschedule na sa room na ito."
  24.             ShowConflict(Data("SectionUnit"), _
  25.             Data("Rooms.Title"), Data("DayID"), _
  26.             Data!TimeStarted, Data!TimeFinished)
  27.             Exit Function
  28.         End If
  29.  
  30.         Data.Close()
  31. End Function
The bold text says "No data exists for the row/column" Please help :'(

Rey Sean
Jun 19 '08 #1
2 1308
jeffstl
432 Expert 256MB
You need to make sure you reader is actually pulling data.

Sounds like its not which means either your query is not right, or the database doesn't have the data you are expecting it to have.

Expand|Select|Wrap|Line Numbers
  1.  
  2. If Data.Read then
  3.      'your data is there
  4. else
  5.      'your data is not there
  6. end if
  7.  
  8.  
Jun 19 '08 #2
lotus18
866 512MB
You need to make sure you reader is actually pulling data.

Sounds like its not which means either your query is not right, or the database doesn't have the data you are expecting it to have.

Expand|Select|Wrap|Line Numbers
  1.  
  2. If Data.Read then
  3.      'your data is there
  4. else
  5.      'your data is not there
  6. end if
  7.  
  8.  
You are a little bit right. I've change the query

Expand|Select|Wrap|Line Numbers
  1. [color=#222222]
  2. [font='Courier New',Courier,monospace]Private Data As OleDbDataReader[/font]
  3. [font='Courier New',Courier,monospace]Private Command As New OleDbCommand[/font]
  4. [font='Courier New',Courier,monospace] [/font]
  5. [font='Courier New',Courier,monospace]Friend Function Conflict(ByVal DayID As String, ByVal Room As String, ByVal _[/font]
  6. [font='Courier New',Courier,monospace] NewTimeStarted As Date, ByVal NewTimeFinished As Date, ByVal SectionUnit As String, _[/font]
  7. [font='Courier New',Courier,monospace]  ByVal Semester As String) As Boolean[/font]
  8. [font='Courier New',Courier,monospace]        'Dim SectionUnit As String[/font]
  9. [font='Courier New',Courier,monospace]        'SectionUnit = Course & " " & Section[/font]
  10. [font='Courier New',Courier,monospace]        'Conflict = False 'Default Value[/font]
  11. [font='Courier New',Courier,monospace] [/font]
  12. [font='Courier New',Courier,monospace] [/font]
  13. [font='Courier New',Courier,monospace]        Main.SetConnection() 'Set Database Connection[/font]
  14. [font='Courier New',Courier,monospace]        'PHASE 1 | CHECK ROOM SCHEDULES[/font]
  15. [font='Courier New',Courier,monospace]        Command = New OleDbCommand("Select * From LoadSchedules Where Rooms.Title='" & Room & _[/font]
  16. [font='Courier New',Courier,monospace]       "' And Not Rooms.Title='Field' And Semester='" & Semester & "' And DayID='" _[/font]
  17. [font='Courier New',Courier,monospace]       & DayID & "'", dbConnection)[/font]
  18. [font='Courier New',Courier,monospace]        Command.CommandType = CommandType.Text[/font]
  19. [font='Courier New',Courier,monospace]        Data = Command.ExecuteReader[/font]
  20. [font='Courier New',Courier,monospace] [/font]
  21. [font='Courier New',Courier,monospace]        If Data.Read Then[/font]
  22. [font='Courier New',Courier,monospace]            Conflict = True[/font]
  23. [font='Courier New',Courier,monospace]            'MsgBox "1 | Conflict sa 1st day. May nakaschedule na sa room na ito."[/font]
  24. [font='Courier New',Courier,monospace]            ShowConflict(Data("SectionUnit"), _[/font]
  25. [font='Courier New',Courier,monospace]            Data("Rooms.Title"), Data("DayID"), _[/font]
  26. [font='Courier New',Courier,monospace]            Data!TimeStarted, Data!TimeFinished)[/font]
  27. [font='Courier New',Courier,monospace]            Exit Function[/font]
  28.                    Else
  29.                              Conflict = False
  30. [font='Courier New',Courier,monospace]        End If[/font]
  31. [font='Courier New',Courier,monospace] [/font]
  32. [font='Courier New',Courier,monospace]        Data.Close()[/font]
  33. [font='Courier New',Courier,monospace]End Function[/font]
[/color]
  •  
  • Thanks : )

    Rey Sean
    Jun 21 '08 #3

    Sign in to post your reply or Sign up for a free account.

    Similar topics

    0
    by: LJ | last post by:
    I have been getting this message and can't resolve the problem. I have checked the AntiVirus software and added the application directory to the exculsion list. The application is on a web farm,...
    6
    by: Tony | last post by:
    Dear All, When I run an example program on the http://www.dotnetjunkies.com/quickstart/util/srcview.aspx?path=/quickstart/aspplus/samples/webforms/data/datagrid1.src&file=VB\datagrid1.aspx&font=3 ...
    1
    by: Curious | last post by:
    Hi, I am trying to use the following code to send data over a Message Queue. The following error is being given: "An unhandled exception of type 'System.InvalidOperationException' occurred in...
    0
    by: vijayalakshmi.venkataraman | last post by:
    Hello, I have a .NET client that accesses a Java webservice. Let me first say that the client stub I got generated from the wsdl was incomplete and had to make changes to it manually to make it...
    8
    by: Sharon | last post by:
    I have a DataGrid control on a Form. The data of the control is added by another application by Remoting. It means that a worker thread is invoking a UI thread. Therefore I used a delegate in the...
    0
    by: banduraj | last post by:
    I get an System.InvalidOperationException when trying to Serialize a struct that has a type refrenced from another library. The exception is: System.InvalidOperationException was unhandled...
    2
    by: snowie | last post by:
    I have a simillar problem to what others have had before me. I just can't find the solution in any earlier post here at the scripts (or any other forum). I am calling a web service that returns a...
    3
    by: Joseph Geretz | last post by:
    System.InvalidOperationException: WebServiceBindingAttribute is required on proxy classes. My environment: Visual Studio 2005, targeting FX 2.0; I've developed a Web Service which uses DIME to...
    0
    by: John H | last post by:
    Hi, Strange error with serialisaation on .net 1.1 Sp1 when a the assembly containing the type is in the Gac as well as on e.g c:\customdlls. ObjValue in below code is populated with and array of...
    1
    by: Tenowg | last post by:
    Hey everyone... Firstly let me tell you this is a project that is probably alittle over my head... I have played with programming most of my life, but I have only been doing VB 2005 for about 2...
    1
    by: CloudSolutions | last post by:
    Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
    0
    by: Faith0G | last post by:
    I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
    0
    isladogs
    by: isladogs | last post by:
    The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
    0
    by: taylorcarr | last post by:
    A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
    0
    by: Charles Arthur | last post by:
    How do i turn on java script on a villaon, callus and itel keypad mobile phone
    0
    by: aa123db | last post by:
    Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
    0
    by: ryjfgjl | last post by:
    In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
    1
    by: nemocccc | last post by:
    hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
    1
    by: Sonnysonu | last post by:
    This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

    By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

    To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.