When you create a typed dataset with a stored procedure containing a temporary table, an error is reported.

Source: Internet
Author: User
I 've been struggling for the past couple months to use the Visual Studio XSD tool to create typed datasets from my stored procedures. but I always get an error telling me the temp table is an invalid object name. I 've just discovered that temp tables are actually not allowed in this tool, due to the way it writes the schema to XML (see this article and this article for details ). there are a couple Things about typed datasets that wocould make my life much easier, so I'm still hoping there's a workaround for this... does anyone know how to create a typed dataset using a stored procedure that creates a temp table? One of the articles I linked to mentions using the set fmtonly on within the stored procedure, but when we tried that we either got no results or a SQL exception.
How do I configure a sqldataadapter to use the results of a temporary table from a stored procedure?
I also want to produce a stronugly typed dataset from the sqldataadapter. The vs wizard states "invalid object name' # mytemptable '" The table mappings is empty.

Solution:
1) vs has only a limited ability to retrieve tabular metadata from stored procedures, and as you have discovered, temp tables are beyond those limits. you shoshould have a dummy table or view in your database which has the same structure as your temp table. in essence this "publishes" the temp table metadata to the world and lets you easily build stronugly-typed datasets from it.

2) You can create the schema directly with the schema tool.

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.