VB 2010 Express and Access 2003
VB 2010 Express and Access 2003
VB 2010 Express and Access 2003
VB 2010 Express and Access 2003
VB 2010 Express and Access 2003
VB 2010 Express and Access 2003 VB 2010 Express and Access 2003 VB 2010 Express and Access 2003 VB 2010 Express and Access 2003 VB 2010 Express and Access 2003 VB 2010 Express and Access 2003 VB 2010 Express and Access 2003 VB 2010 Express and Access 2003
VB 2010 Express and Access 2003 VB 2010 Express and Access 2003
VB 2010 Express and Access 2003
Go Back  Xtreme Visual Basic Talk > > > VB 2010 Express and Access 2003


Reply
 
Thread Tools Display Modes
  #1  
Old 02-10-2014, 01:59 AM
skarosi skarosi is offline
Newcomer
 
Join Date: Jan 2004
Posts: 9
Default VB 2010 Express and Access 2003


Hi all,
I have been trying to find anything i can use to connect my VB project to an Access databse i created.
This is my code

Code:
Dim connectionString As String="provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\db.mdb;"
Dim mySql as String ="Select * from ....")

Dim con as New OleDb.OleDbConnection(constr)
con.Open()
Dim cmd As New OleDb.OleDbCommand(mySql,con)
dim reader As OleDb.OleDbDataReader
reader=cmd.ExecuteReader
reader.close()
con.close()
The problem is that i am getting an error on reader=cmd.ExecuteReader. I get this message
Quote:
No value given for one or more required parameters
I have been trying many differnet code samples i found, but for all i get the same message.

Any help will be appreciated.

ilias

P.S I am not sure if the error message is the correct one, since i am using non english windows. This is a rough translation of my own.
Reply With Quote
  #2  
Old 02-10-2014, 02:17 PM
CharlieMay's Avatar
CharlieMay CharlieMay is offline
Regular
 
Join Date: Sep 2009
Location: Indiana
Posts: 89
Default

If you are NOT using parameterized statements then this error usually appears if you have included a column in your statement that does not appear in your table. (keep in mind that this can even be a misspelled name). Check through your statement and make sure everything is correct.

If this doesn't fix it, post your SQL statement. Your code looks fine otherwise.

EDIT:
By fine, I mean that it would not produce errors. However, you are executing the reader and then immediately closing it. You will want to loop through the reader results and display them somehow prior to closing the reader so keep that in mind when you get beyond this error.
__________________
I thought I knew what I was doing...
...And then I turned on Option Strict
Reply With Quote
  #3  
Old 02-13-2014, 08:02 AM
skarosi skarosi is offline
Newcomer
 
Join Date: Jan 2004
Posts: 9
Default

So stupid of me!
The select command was wrong.
I copied it from access, where it was working, and i presumed it was right, but it wasnt.

Thanks, i would have thought of checking it by my self
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
VB 2010 Express and Access 2003
VB 2010 Express and Access 2003
VB 2010 Express and Access 2003 VB 2010 Express and Access 2003
VB 2010 Express and Access 2003
VB 2010 Express and Access 2003
VB 2010 Express and Access 2003 VB 2010 Express and Access 2003 VB 2010 Express and Access 2003 VB 2010 Express and Access 2003 VB 2010 Express and Access 2003 VB 2010 Express and Access 2003 VB 2010 Express and Access 2003
VB 2010 Express and Access 2003
VB 2010 Express and Access 2003
 
VB 2010 Express and Access 2003
VB 2010 Express and Access 2003
 
-->