You must Sign In to post a response.
  • Category: ASP.NET

    Get and Display records from database

    Hi Developers,
    below i have added my code.
    I want to get and dis[lay group of records from the database.If anyone know Please tell me what is the error on my code.
    i got a error like this
    No value given for one or more required parameters.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

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

    Source Error:

    Line 32:
    Line 33: OleDbDataAdapter oda = new OleDbDataAdapter(view, con);
    Line 34: oda.Fill(ds);
    Line 35: if (ds.Tables[0].Rows.Count > 0)
    Line 36: {

    protected void Page_Load(object sender, EventArgs e)

    if (Session["uid"] == null)
    if (Session["indexid"] == null)
    if (!IsPostBack)
    OleDbConnection con = Connection.DBconnection();
    string view = "select Id,PetName,Noofdogs,PetAge,PetSex,Heat,Vaccination_Details,Health_Details,Temparent from tbl_Petdetails where id=" +Convert.ToInt32(Session["indexid"].ToString()) + " and Emailid='"+ Session["uid"].ToString() + "'";
    OleDbDataAdapter oda = new OleDbDataAdapter(view, con);
    if (ds.Tables[0].Rows.Count > 0)
    txtid.Text = ds.Tables[0].Rows[0]["Id"].ToString();
    txtpetname.Text = ds.Tables[0].Rows[0]["PetName"].ToString();
    ddlnoofdogs.Text = ds.Tables[0].Rows[0]["Noofdogs"].ToString();
    txtpetage.Text = ds.Tables[0].Rows[0]["PetAge"].ToString();

    txtpetsex.Text = ds.Tables[0].Rows[0]["PetSex"].ToString();
    // FileUpload1.Text = ds.Tables[0].Rows[0]["Photo"].ToString();
    rblheat.Text = ds.Tables[0].Rows[0]["Heat"].ToString();
    txtvacdetail.Text = ds.Tables[0].Rows[0]["Vaccination_Details"].ToString();
    txthealthdetail.Text = ds.Tables[0].Rows[0]["Health_Details"].ToString();
    rbltemparent.Text = ds.Tables[0].Rows[0]["Temparent"].ToString();

    Thanking with
  • #762082

    I request you to please recheck your query, check whether is there any corrections are there in that, like column name and single Quotes etc...

    If you have any issues, please put a break point and recheck line by line after getting query in string object copy that and paste it in your query builder and recheck once again, whether it gives result perfectly or not.

    Hope you got my point..

    Give respect to your work, Instead of trying to impress your boss.

    Blog :

  • #762085
    hmm thanks your good but am using oledb database so what are the things i need to do?

  • #762093

    Trace your Query for ex: if you use ms-asccess check this query query analizer then check your session part value assign or not then your select query session coming correct data type format. But in your code using sql server working good no issue try one msacess means query window.

    Name : Dotnet Developer-2015
    Email Id

    'Not by might nor by power, but by my Spirit,' says the LORD Almighty.

  • #762096

    Check all these details (PetName,Noofdogs,PetAge,PetSex,Heat,Vaccination_Details,Health_Details,Temparent)
    are present in your database table tbl_Petdetails .

    And see these names ( id and Emailid ) are correct column names as in the database.


    Sridhar Thota.

    Sridhar Thota.
    Editor: DNS Forum.

  • #762106
    Hello Paul Raj,

    Put break point in your code. use this type of code :

    // Your code goes here
    catch(Exception ex)

    So that you will know it what error and on which line you are getting an error.

    Hope this will help you.

    Nirav Lalan
    DNS Gold Member
    "Failure is the path of least persistence"

Sign In to post your comments