Error when filling dataadapter
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums
Results 1 to 1 of 1

Thread: Error when filling dataadapter

  1. #1
    Join Date
    Dec 2009

    Error when filling dataadapter


    I keep getting this message whenever I delete something from a database. What I am doing is implementing the delete fucntion for a post in a forum. I have two applciation a Webservice and a Website

    Here is my code for the method in the service
        public DataSet GetPosts(string queryStr)
            DataSet ds = new DataSet();
            OleDbDataAdapter myDataAdapter = new OleDbDataAdapter(queryStr, connection);
            myDataAdapter.Fill(ds, "Posts");
            return ds;
    and here is the code in the website
    protected void Repeater_ItemCommand(object sender, RepeaterCommandEventArgs e)
            DataSet ds;
            int postId = Convert.ToInt32(e.CommandArgument);
            switch (e.CommandName)
                case "Del":
                    Response.Write("the id of the post clicked = " + postId);
                    string delPost = "DELETE * FROM Posts WHERE PostID =" + postId;
                    object temp = Session["trdID"];
                    int h = Convert.ToInt32(temp) + 1;
                    object temp2 = Session["secID"];
                    int i = Convert.ToInt32(temp2) + 1;
                    string queryStr = "SELECT Posts.*, Accounts.* FROM Posts INNER JOIN Accounts ON Posts.AccountID = Accounts.ID WHERE ThreadID = "+h+" AND SectionID = "+i+" ORDER BY DateCreated";
                    ds = myws.GetPosts(queryStr);
                case "Edit":
    However I get a SOAP exception on this line
    ds = myws.GetPosts(queryStr);
    "System.Data.OleDb.OleDbException: No value given for one
    or more required parameters."

    This is due to the dataadapter not being able to be filled for some reason. I dont know if its because im deleting from an access database or not...

    Can anyone help?
    Last edited by dovobet; May 13th, 2010 at 09:06 PM.

Posting Permissions

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

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

This is a survey!

HTML5 Development Center