C# 3.0 in a Nutshell
C# 3.0 in a Nutshell, Third Edition A Desktop Quick Reference By Joseph Albahari, Ben Albahari
September 2007
Pages: 858


Welcome Guest ( Log In | Register )

Wierd Linqpad Update Behavior
Terry Aney
post Apr 11 2008, 12:53 PM
Post #1


Active Member
**

Group: Members
Posts: 16
Joined: 25-March 08
Member No.: 169



I am working on finalizing an implementation to support functionality simliar to: http://weblogs.asp.net/jeffreyzhao/archive...expression.aspx

I have the following LINQPad select statement:

CODE
var posts =
    from p in be_Posts
    where p.PostID == new Guid( "fb68266f-3ed6-4572-956b-8c2c54a30928" )
    select p;


When I run an update batch statement (don't worry I plan on blogging about this whole thing once I've ironed out everything), essentially the SQL command text to run will be:

CODE
UPDATE [be_Posts]
SET [Author] = @Author0

FROM [be_Posts] AS j0 INNER JOIN (

SELECT [t0].[PostID]
FROM [be_Posts] AS [t0]
WHERE [t0].[PostID] = @p0

) AS j1 ON (j0.[PostID] = j1.[PostID])

-- @p0: Input UniqueIdentifier (Size = 0; Prec = 0; Scale = 0) [fb68266f-3ed6-4572-956b-8c2c54a30928]
-- @Author0: Input NVarChar (Size = 8; Prec = 0; Scale = 0) [Ann Aney]
-- Context: SqlProvider(Sql2005) Model: AttributedMetaModel Build: 3.5.21022.8


Now, if I take that *exact* SQL to QueryEx or SQL Management Studio, it runs fine, but LINQPad returns an error of:

SqlException: Must declare the scalar variable "@Author0". Incorrect syntax near the keyword 'AS'.

LINQPad obviously display more information I can append if needed, but that is a start. Any ideas to why it wouldn't work only in LINQPad (admittedly I've yet to write a little test app to test it in stand alone C# application).
Go to the top of the page
 
+Quote Post



Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

RSS Lo-Fi Version Time is now: 22nd November 2009 - 04:28 PM