I am having problems accessing the Data Set, when i would type DataSet ds = new DataSet(); i will always get the red arrow line underneith, I then right clicked on the data > choose items in the toolbox and it is already checked yet i cant create it in code, any idea why?

Recommended Answers

I would suggest providing a copy of the code with this in.

What your currently doing is correct, and so therefore the surrounding code my shed some light on things.

Jump to Post

All 4 Replies

I would suggest providing a copy of the code with this in.

What your currently doing is correct, and so therefore the surrounding code my shed some light on things.

Basically i need a data set to connect to a grid view in a different form, i have all the other necessary objects but a data set is what i need.

            command.Connection.Open();

            dr = command.ExecuteReader();

            if (dr.Read())
            {

                txtCustomerID.Text = dr["@CustomerID"].ToString();
                txtCompanyName.Text = dr["@CompanyName"].ToString();
                txtContactName.Text = dr["@ContactName"].ToString();
                txtContactTitle.Text = dr["@ContactTitle"].ToString();
                txtAddress.Text = dr["@Address"].ToString();
                txtCity.Text = dr["@City"].ToString();
                txtRegion.Text = dr["@Region"].ToString();
                txtPostalCode.Text = dr["@PostalCode"].ToString();
                txtCountry.Text = dr["@Country"].ToString();
                txtPhone.Text = dr["@Phone"].ToString();
                txtFax.Text = dr["@Fax"].ToString();

                dr.Close();

                Response.Redirect("ViewCustomer.aspx");

          }

What are you trying to do here? You seem to be setting textboxes to values retrieved from a database and then immediately redirecting the user to another page. Whats the point in doing that?
If you want to populate that data on another page there your should be doing the data extraction on that page as well.

All Sorted, just needed a simple using namespace.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.