Exception error, how to solve or handle it?

Hi, could someone tell me whats the meaning of the error and how can I solve it. Thanks.

here my code:

public static void ReadData()

{

string connectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\FYPproject.mdb";

string queryString =

"SELECT Sample_Number,Pump_Speed FROM 2Pumps";

using (OleDbConnection connection = new OleDbConnection(connectionString))

{

OleDbCommand command = new OleDbCommand(queryString, connection);

connection.Open();

OleDbDataReader reader = command.ExecuteReader(); <<Error on this line

while (reader.Read())

{

MessageBox.Show(String.Format("{0} , {1}",

reader[0], reader[1]));

}

reader.Close();

}

}

Error is :

System.Data.OleDb.OleDbException: No value given for one or more required parameters.

No build errors found. Program can start.




Answer this question

Exception error, how to solve or handle it?

  • yyz2112

    To ahmedilyas,

    Is it me or MSDN forums got bug It should display the latest post at the bottom but my post at 1:26 PM UTC  is not at the bottom  

    To V.Tortola and ahmedilyas,

    Back to square one, my error is stated in my first post.

    Tried ending with ';'

    Thanks.



  • Grant McElroy

    The path incorrect. How do I find the correct path Do I drill down to the folder where the file resides and use that address or do I use something like this:

    "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\folder;Extended Properties=dBASE IV;User ID=Admin;Password=";
    Thanks.



  • Scotty12105

    First try to put the absolute path in 'DataSource=' (ie: C:\myproject\myapp\mydbdir\mydb.mdb) to ensure that can find the file.

    After try to put the relative path, that's the elegant way :) (ie: ..\mydbdir\mydb.mdb).

    Regards.



  • 041661K

    Back to square one, see my first post ontop.

    Does that mean I solved the 'Could not find installable ISAM.' error Because the current error is 'No value given for one or more required parameters.' see my first post for more details.



  • korenwolf

    Web page missing:

    http://support.microsoft.com/kb/209805

    This is my connectstring = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\FYP\FYPproject.mdb"

    Repaired office, searched for every file to check the path name against the actual path name.

    still I got this error:

    Could not find installable ISAM.



  • TDerenthal

    I use the file that is in the release folder right

    It does not matter that the absolute path have spacing in between

    ie: C:\myproject\my app\my db dir\mydb.mdb

     

    Update: Tried the  absolute path. Error is Could not find installable ISAM.



  • mattdawg

    connectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\FYP\FYPproject.mdb"

    Maybe lacks the semicolon at end.

    connectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\FYP\FYPproject.mdb;";

    Regards.



  • smk_k

    the web page  works, open it then close it again then open it - the MS Site is a bit flakey the last couple of weeks

    tried this connectionstring

    Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\somepath\mydb.mdb;User Id=admin;Password=;"



  • tattoo

    Solved.

    The problem is that my MS Access database do not have a Primary key to ensure data integrity, therefore got error.

    Edited: No need a Primary Key but need a int so the reader can read from 1st to last.



  • Mr Dave

    sorry I am a beginner, could you please elaborate. Thanks.

  • Ori&amp;#39;

    http://support.microsoft.com/kb/209805

    http://databases.aspfaq.com/database/how-do-i-solve-could-not-find-installable-isam-errors.html

    your connection string should be like this, that is if the database is in the same directory as the application:

    string connectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Application.StartupPath + "\FYPproject.mdb";



  • kidwidahair

    Try

    int Result = command.ExecuteNonQuery();

    instead

    OleDbDataReader reader = command.ExecuteReader();

    to view if your connection is OK

    Your connectionstring ...

    @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\FYPproject.mdb";

    Would be:

    @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=DataDirectory\FYPproject.mdb";

    Is the path correct

    Regards.



  • Polarbear541

    Test the command.ExecuteNonQuery() instead.

  • Exception error, how to solve or handle it?