Comments (10)
That's a good one, thanks for testing!
On Oct 25, 2013 10:57 PM, "Jack Fox" [email protected] wrote:
It appears you cannot use the same parameter more than once.
Comment out the second occurence:
--OR city LIKE @startsWith
and it builds.
Error 6 The type provider 'FSharp.Data.SqlClient.SqlCommandTypeProvider'
reported an error: The undeclared parameter '@startsWith' is used more than
once in the batch being analyzed.[]
let sqlCityCounty = @"
SELECT DISTINCT
streetName = null,
streetAddress = null,
postalCode = null,
listingID = null,
mlsID = null,
classID = null,
neighborhood = null,
countryCode,
state,
county,
city
FROM tbMLSQuickLocationListingCount WITH (NOLOCK)
WHERE
(
county LIKE @startsWith
OR city LIKE @startsWith
)
AND locationType = 'City'
AND MLSID IN (select * from dbo.ConvertCommaSeparatedStringToTableOfInts(@mlsIDList))
AND CASE WHEN (MLSID = 10 AND companyID = @companyid) OR MLSID <> 10 THEN 1 ELSE 0 END = 1"type QueryCityCounty = SqlCommand<sqlCityCounty, ConnectionStringName="staging", ResultType = ResultType.Records, ConfigFile="AutoComplete.config">
let cmd1 = QueryUserMLS(startsWith = "7L%", mlsIDList = "1,2,3", companyID = 1)β
Reply to this email directly or view it on GitHubhttps://github.com//issues/13
.
from fsharp.data.sqlclient.
@jackfoxy Jack, I will look into the issue.
from fsharp.data.sqlclient.
Thanks.
Found this by accident. I donβt have to perform that query, but good to identify the issue.
From: Dmitry [mailto:[email protected]]
Sent: Friday, October 25, 2013 8:09 PM
To: dmitry-a-morozov/FSharp.Data.SqlCommandTypeProvider
Cc: Jack Fox
Subject: Re: [FSharp.Data.SqlCommandTypeProvider] undeclared parameter cannot be used more than once (#13)
@jackfoxy https://github.com/jackfoxy Jack, I will look into the issue.
β
Reply to this email directly or view it on GitHub #13 (comment) . https://github.com/notifications/beacon/qagoFbftMXzJr4d1v9KIqp5_a7A6T-YB64Px8e6g0fl2Jx45DElcwzcm0crU2eST.gif
from fsharp.data.sqlclient.
From the docs:
sp_describe_undeclared_parameters returns an error in any of the following cases.
- If the input @tsql is not a valid Transact-SQL batch. Validity is determined by parsing and analyzing the Transact-SQL batch. Any errors caused by the batch during query optimization or during execution are not considered when determining whether the Transact-SQL batch is valid.
- If @params is not NULL and contains a string that is not a syntactically valid declaration string for parameters, or if it contains a string that declares any parameter more than one time.
- If the input Transact-SQL batch declares a local variable of the same name as a parameter declared in @params.
- If the statement creates any temporary tables.
These are the limitations of this TP, and maybe they should be documented here.
There's not much to be done about this, other than a simple workaround. Make sure each @param is declared only once:
DECLARE @input int
SET @input = @parm
SELECT *
FROM sys.indexes
WHERE @input = 1 or @input = 2
from fsharp.data.sqlclient.
@rojepp Thanks for help
from fsharp.data.sqlclient.
fixed in ver 1.7.6
from fsharp.data.sqlclient.
Looks like the issue reopen is due. TP fails to accept the following query:
.....................
WHERE <predicate>
AND (@Param = '' OR [Field] = @Param)
with diagnostics "An item with the same key has already been added".
from fsharp.data.sqlclient.
@geandbe The workaround I posted above doesn't work?
from fsharp.data.sqlclient.
Sure it does, but workaround <> closed issue, right?
from fsharp.data.sqlclient.
The workaround works, but is this not possible to fix? Using e.g. @input = '' OR @input = 'asd'
in a normal SQL script works fine without declaring it, but fails using using this type provider.
from fsharp.data.sqlclient.
Related Issues (20)
- Dacpac support info HOT 3
- "F# Formatting" link is broken
- Can't build/run from the commandline, but can from Visual Studio 2019 HOT 2
- Question: Creating a provider without an access to DB HOT 3
- SqlEnumProvider breaks VS 2019 HOT 2
- Not platform detection Fable HOT 1
- Build is broken without full VS installation
- Fixed length binary columns in user defined table types fail when constructed HOT 8
- Cannot use User Defined Table Types with the SqlCommandProvider HOT 5
- .NET 6 support HOT 6
- One line summary of the bug HOT 2
- TVP Column Ordering is incorrect as of version 2.1.0
- Cannot use parameter name more than once in a script HOT 3
- System.Data.SqlClient is not supported on this platform. HOT 5
- Conversion failed when using User Defined Table Types HOT 1
- Any 2023 tricks for running on Windows? HOT 3
- NullReferenceException in SqlConnection.UseLocally HOT 1
- Support for 'Active Directory Interactive' authentication HOT 3
- dotnet SDK projects using FSharp.Core version 7.0.0 breaks at runtime HOT 3
- SQL LIKE operation doesn't recognize variable HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fsharp.data.sqlclient.