Results 1 to 9 of 9

Thread: [RESOLVED] Exception reading Database

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Sep 2006
    Location
    UK / East Sussex
    Posts
    1,054

    Resolved [RESOLVED] Exception reading Database

    Good Afternoon All, I have built everything for Beta one and I thought I had done very well until and Exception happens when I try and run it. Please could someone take a look at this and see if you know whats causing it:

    Message: {"No value given for one or more required parameters."}
    Error Code: -2147217904
    Item: In order to evaluate an indexed property, the property must be qualified and the arguments must be explicitly supplied by the user.

    I don't know whether more info is required from the error but it happens on this line:

    DReader = DSelectCommand.ExecuteReader

    Here is the full code:

    HTML Code:
    Dim DoleDBConn As New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Application.StartupPath & "\DBtord.mdb;User Id=admin;Password=;")
    
            Dim DSelectCommand As New OleDb.OleDbCommand("SELECT Record,TimeLimit,Displays,NamePlayer FROM Dares WHERE Category IN " & SelectedPacks, DoleDBConn)
    
            DoleDBConn.Open()
    
            Dim DReader As OleDb.OleDbDataReader
    
            DReader = DSelectCommand.ExecuteReader
    
            DareDT.Load(DReader)
    
            DReader.Close()
            DoleDBConn.Close()
    I have checked the database is in the target location and the table names and column names are all correct.
    M.Carpenter

    Server Admin for Wurm Online
    Wurm Online - A very unique and original MMO from Code Club AB
    https://www.youtube.com/watch?v=YQlYar2uHWAWurm Trailor


  2. #2

    Thread Starter
    Frenzied Member
    Join Date
    Sep 2006
    Location
    UK / East Sussex
    Posts
    1,054

    Re: Exception reading Database

    Also if it helps the Varible 'SelectedPacks' in the Command currently equals:

    ('1','7')
    M.Carpenter

    Server Admin for Wurm Online
    Wurm Online - A very unique and original MMO from Code Club AB
    https://www.youtube.com/watch?v=YQlYar2uHWAWurm Trailor


  3. #3
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Exception reading Database

    what is the data type for the field Category? Integer, string, varchar, boolean?

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  4. #4

    Thread Starter
    Frenzied Member
    Join Date
    Sep 2006
    Location
    UK / East Sussex
    Posts
    1,054

    Re: Exception reading Database

    String - Not sure why I set this like this? Should I change it to Integer?

    Record = Text
    Group = Text
    TimeLimit = Number
    Displays = Number
    NamePlayer = Yes/No

    And I think I have just spotted the problem - Two secs while I test...
    M.Carpenter

    Server Admin for Wurm Online
    Wurm Online - A very unique and original MMO from Code Club AB
    https://www.youtube.com/watch?v=YQlYar2uHWAWurm Trailor


  5. #5

    Thread Starter
    Frenzied Member
    Join Date
    Sep 2006
    Location
    UK / East Sussex
    Posts
    1,054

    Re: Exception reading Database

    Ok no thats not fixed it although was a problem, The column was actually called 'Group' not Category so I have changed the command to:

    "SELECT Record,TimeLimit,Displays,NamePlayer FROM Dares WHERE Group IN " & SelectedPacks, DoleDBConn


    New Error: {"Syntax error in WHERE clause."}
    Error Code: -2147217900
    M.Carpenter

    Server Admin for Wurm Online
    Wurm Online - A very unique and original MMO from Code Club AB
    https://www.youtube.com/watch?v=YQlYar2uHWAWurm Trailor


  6. #6
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Exception reading Database

    now you've run into another problem... GROUP is a reserved word in SQL (as in GROUP BY) ... so it really shouldn't be used as a field name.

    In the DB FAQ/Tutorial you'll find a link to What names should I NOT use for tables/fields/views/stored procedures/...? (includes listings of Reserved Words) -- that may be helpful.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  7. #7

    Thread Starter
    Frenzied Member
    Join Date
    Sep 2006
    Location
    UK / East Sussex
    Posts
    1,054

    Re: Exception reading Database

    Ahh Ok Ill just rename it to Category then :-)
    M.Carpenter

    Server Admin for Wurm Online
    Wurm Online - A very unique and original MMO from Code Club AB
    https://www.youtube.com/watch?v=YQlYar2uHWAWurm Trailor


  8. #8

    Thread Starter
    Frenzied Member
    Join Date
    Sep 2006
    Location
    UK / East Sussex
    Posts
    1,054

    Re: Exception reading Database

    Hmm not haveing much luck here - Renamed same line of code different error:

    No value given for one or more required parameters.
    M.Carpenter

    Server Admin for Wurm Online
    Wurm Online - A very unique and original MMO from Code Club AB
    https://www.youtube.com/watch?v=YQlYar2uHWAWurm Trailor


  9. #9

    Thread Starter
    Frenzied Member
    Join Date
    Sep 2006
    Location
    UK / East Sussex
    Posts
    1,054

    Re: Exception reading Database

    Ok I think I have got over the problem. I have declared the two columns that where numbers to text and that works now. :-)

    Thanks for your help.
    M.Carpenter

    Server Admin for Wurm Online
    Wurm Online - A very unique and original MMO from Code Club AB
    https://www.youtube.com/watch?v=YQlYar2uHWAWurm Trailor


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width