Hi everyone,
I have a SPROC which selects records into a MSSQL #temp table and then
selects the records from that. I drag this SPROC onto the right-hand
pane of the DBML diagram, but the method that gets generated for the
SPROC does not have a return type. Any ideas why this is?
I am referring to Scott Guthrie's blog article here: http://weblogs.asp.net/scottgu/archi...rocedures.aspx 4 2353
I have checked, and yes - this appears to be the case even for simple
cases.
I would guess that this is because the metadata for temp-tables is *in
the general case* too weak (since the table could be external to the
SP, or could have multiple create points [either of which would also
cause constant SP recompiles]).
If your data-volumes aren't immense, and you don't use an index on the
temp-table, then perhaps consider using a table-variable instead [
DECLARE @varname TABLE (...) ]; the metadata is much stronger and it
works as expected.
If table-variables aren't an option, then you can also edit the dbml
directly: right-click; Open With...; XML Editor; locate your SP and
replace e.g.
<Return Type="System.In t32" />
with
<ElementType Name="StoredPro cedure2Result"> <!-- bad name ;-p -->
<Column Name="ID" Type="System.In t32" DbType="Int NOT NULL"
CanBeNull="fals e" />
<Column Name="Value" Type="System.In t32" DbType="Int NOT NULL"
CanBeNull="fals e" />
</ElementType>
and rebuild.
Note that there is also a LINQ-specific forum that you may find
useful: http://forums.microsoft.com/MSDN/Sho...D=123&SiteID=1
Marc
Marc Gravell wrote:
I have checked, and yes - this appears to be the case even for simple
cases. I would guess that this is because the metadata for
temp-tables is *in the general case* too weak (since the table could
be external to the SP, or could have multiple create points [either
of which would also cause constant SP recompiles]).
If your data-volumes aren't immense, and you don't use an index on
the temp-table, then perhaps consider using a table-variable instead
[ DECLARE @varname TABLE (...) ]; the metadata is much stronger and
it works as expected.
If table-variables aren't an option, then you can also edit the dbml
directly: right-click; Open With...; XML Editor; locate your SP and
replace e.g. <Return Type="System.In t32" /with
<ElementType Name="StoredPro cedure2Result"> <!-- bad name ;-p -->
<Column Name="ID" Type="System.In t32" DbType="Int NOT NULL"
CanBeNull="fals e" / <Column Name="Value" Type="System.In t32"
DbType="Int NOT NULL" CanBeNull="fals e" / </ElementType>
and rebuild.
Note that there is also a LINQ-specific forum that you may find
useful:
http://forums.microsoft.com/MSDN/Sho...D=123&SiteID=1
Marc
It's due to an issue in sqlserver. See my reply in the adonet
newsgroup on this server.
FB
--
------------------------------------------------------------------------
Lead developer of LLBLGen Pro, the productive O/R mapper for .NET
LLBLGen Pro website: http://www.llblgen.com
My .NET blog: http://weblogs.asp.net/fbouma
Microsoft MVP (C#)
------------------------------------------------------------------------
Hi Marc
Thanks for your insightful reply. Great tip on editing the dbml file,
wasn't aware that you could directly edit it. I did use a @temp table
variable and it worked. However after binding to the grid directly I
had trouble sorting and paging. I also could not bind the method to an
ObjectDataSourc e and from memory the error given was 'This method(?)
does not support server side paging(?)' or something along those
lines. Anyway ended up reverting to good old a DataSet and an
ObjectDataSourc e for binding to my ASP.NET GridView :)
On Dec 4, 6:35 pm, "Marc Gravell" <marc.grav...@g mail.comwrote:
I have checked, and yes - this appears to be the case even for simple
cases.
I would guess that this is because the metadata for temp-tables is *in
the general case* too weak (since the table could be external to the
SP, or could have multiple create points [either of which would also
cause constant SP recompiles]).
If your data-volumes aren't immense, and you don't use an index on the
temp-table, then perhaps consider using a table-variable instead [
DECLARE @varname TABLE (...) ]; the metadata is much stronger and it
works as expected.
If table-variables aren't an option, then you can also edit the dbml
directly: right-click; Open With...; XML Editor; locate your SP and
replace e.g.
<Return Type="System.In t32" />
with
<ElementType Name="StoredPro cedure2Result"> <!-- bad name ;-p -->
<Column Name="ID" Type="System.In t32" DbType="Int NOT NULL"
CanBeNull="fals e" />
<Column Name="Value" Type="System.In t32" DbType="Int NOT NULL"
CanBeNull="fals e" />
</ElementType>
and rebuild.
Note that there is also a LINQ-specific forum that you may find
useful:
http://forums.microsoft.com/MSDN/Sho...D=123&SiteID=1
Marc
Fair enough; the paging etc probably would have been solvable, but
obviously it isn't going to be able to inject sort/page code directly
into an SP. But if you're happy...
Marc This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Oksana Yasynska |
last post by:
Hi all,
I'm running Postgres 7.2.1 and I need to return multiple row sets from plpgsql
function. I'm new in plpgsql but according documentation and everything I
could find in the mailing list I need to switch to 7.3 to get at least SETOF
rows as a result.
I can't really upgrade Postgres now. Is there is any a workaround idea to
retrieve multiple rowsets?
|
by: Boris Popov |
last post by:
Hello pgsql-general,
I'm trying to implement a table with rows that are automatically
deleted when the session that inserted them disconnects, sort of like
our own alternative to pg_stat_activity. Is it possible and what
approach should I be trying to achieve such a thing?
Thanks!
--
|
by: shapper |
last post by:
Hello,
I created 3 few tables that have Many to Many relationships:
Posts (PostId PK)
Files (FileId PK)
PostsTags (PostId PK, TagId PK)
FilesTags (FileId PK, TagId PK)
|
by: Ralf Rottmann \(www.24100.net\) |
last post by:
I recently stumbled across a pretty interesting LINQ to SQL question and
wonder, whether anybody might have an answer. (I'm doing quite some
increasing LINQ evangelism down here in Germany.).
Assume I want to select rows from a database and check whether a specific
column contains keywords from a list of keywords. The following works just
fine:
List<stringsearchTerms = new List<string>() { "Maria",
"Pedro" };
|
by: Esteban404 |
last post by:
//using C# 2005, MS SQL 2000(prod) and SQL Express 2005 (dev)
My sprocs all have a clearing mechanism at the end like this for each temporary table I use:
--drop temporary tables
IF EXISTS(SELECT name FROM ..sysobjects WHERE name = N'#Temp' AND xtype='U')
DROP TABLE #Temp
Every once in a while, something will happen to cause a hiccup and the table doesn't clear. The result is no results, not an error message (reader fails). I added the...
| |
by: john |
last post by:
LINQ works a lot like an Access DB Recordset in the way it functions, one of
the things I could do in Access is refer to the Fields thru a Variable as
below allowing me to Iterate over the Recordset with a test or slight change
to field names. Is there a way to Replicate this Method in LINQ, I've tried
setting the Variable as an Object "Dim tDayID AS Object = "tem.Day" & 1" but
it did not work?
IN ACCESS:
Dim DaI As String
DaI =...
|
by: Iaml |
last post by:
I have an XML file and the depth of each node is unpredictable.
I need to find the parent node which contains an element whose
certain attribute has the given value. Then I will process that
parent node.
As I said, the node's depth is unpredictable, all nodes in the xml
file have the same tag name. For example, all nodes start with things
like
|
by: Dan Tallent |
last post by:
I have a query which I would like to convert to LINQ. I am having
problems finding good examples or references that cover more complex
queries.
Here is the SQL command I would like to rewrite into C# LINQ. Notice
that one of the returned fields "XrefID" is coming from the second table.
This information is very important but its complicating the query expression
in C# The DataContext has the two classes for the two tables...
|
by: =?Utf-8?B?UGF1bCBQcmV3ZXR0?= |
last post by:
I'm attempting to use LINQ to insert a record into a child table and I'm
receiving a "Specified cast is not valid" error that has something to do w/
the keys involved. The stack trace is:
======================
Message: Specified cast is not valid.
Type: System.InvalidCastException
Source: System.Data.Linq
TargetSite: Boolean TryCreateKeyFromValues(System.Object, V ByRef)
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |