|
-
Dec 23rd, 2009, 10:37 AM
#1
Thread Starter
Frenzied Member
[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.
-
Dec 23rd, 2009, 10:39 AM
#2
Thread Starter
Frenzied Member
Re: Exception reading Database
Also if it helps the Varible 'SelectedPacks' in the Command currently equals:
('1','7')
-
Dec 23rd, 2009, 10:54 AM
#3
Re: Exception reading Database
what is the data type for the field Category? Integer, string, varchar, boolean?
-tg
-
Dec 23rd, 2009, 11:15 AM
#4
Thread Starter
Frenzied Member
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...
-
Dec 23rd, 2009, 11:18 AM
#5
Thread Starter
Frenzied Member
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
-
Dec 23rd, 2009, 11:21 AM
#6
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
-
Dec 23rd, 2009, 11:22 AM
#7
Thread Starter
Frenzied Member
Re: Exception reading Database
Ahh Ok Ill just rename it to Category then :-)
-
Dec 23rd, 2009, 11:26 AM
#8
Thread Starter
Frenzied Member
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.
-
Dec 23rd, 2009, 11:35 AM
#9
Thread Starter
Frenzied Member
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|