Scott Mitchell's tutorial on Access Database (I)

Source: Internet
Author: User

Problem 1: An error occurred while querying with parameters, such as select * from user where userid = @ userid;
Solution:
If you are using the access version of northwind, replace the @ city parameter with the question mark. (Select customerid, companyName, contactname, contacttitle, address, city, region, postalcode, country, phone, fax from customers where city =?)

Problem 2: an error occurs when an SQL statement with a subquery is used;
Solution:
Yeah, the typed dataset wizard tends to screw up things a bit. you end up finding workarounds. in the case of these subqueries .. I don't know that I wowould agree, joins are much more efficient if simply because you save all the typing from all those other fields. I wocould suggest this to you. when you are creating a new table wizard, go ahead and do a simple query with all your normal fields (no joins or subqueries ), this will allow your tableadapter to successfully auto generate the crud stuff (create, retrieve, update, delete ).

once you have done that, you will see your datatable and tableadapter view with everything there outer t your join fields. click on your table adapter and you will see that its default query is the getdata query, In the Properties window you get insert, update, delete, and select statements. go in at this point and change the SELECT statement to reflect the join statements and all the extra fields you want to have. the tricky part comes when it asks you if you want to refresh your queries. the wizard basically is asking if you want to refresh your tableadapter and datatable with your newly minted SELECT statement with the joins in there, say no as this will, in effect, delete your auto generated updates/inserts/deletes.

MSN me if you have any issues with this stuff, I have actually taken Scott's class at the UCSD extension and spent some time learning from him in a one on one scenario (he is expensive but absolulely worth it if you live in San Diego.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.