Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Help with Stored Procedures
Message
De
22/09/2004 09:22:35
 
 
À
22/09/2004 06:19:11
Information générale
Forum:
ASP.NET
Catégorie:
Bases de données
Divers
Thread ID:
00944901
Message ID:
00944947
Vues:
24
Martin,

I suppose you're using ADO instead of ADO.NET because of existing code that you had in an old VB6 app, correct? Do you plan to port that to ADO.NET at some point?

Anyway, I bet your problem is the extra quotes around your last parameter. Why don't you try this:
rs=cn.Execute("_1001 '09/01/2004', '09/30/2004, '341-111-01'")
~~Bonnie



>Hi ol! I have a stored procedure that accepts 3 parameters. When I test it in the SQL Query Analyzer using the syntax...
>
>execute _1001 '09/01/2004', '09/30/2004, '''341-111-01'''
>
>... I get the correct results. But when I use the following syntax in VB...
>
>rs=cn.Execute("_1001 '09/01/2004', '09/30/2004, '''341-111-01'''")
>
>... I get the error message...
>
>Run-time exception thrown : System.Runtime.InteropServices.COMException - [Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax near '341'.
>
>Any idea on this? By the way, I am using VB.NET and ADO 2.5 not ADO.NET. My store procedure looks something like this:
>
>CREATE PROCEDURE _1001
>@DateFrom DateTime,
>@DateTo DateTime,
>@AcctList varchar(100)
>
>AS
>
>DECLARE @Sql nvarchar(4000)
>
>SET @Sql = 'SELECT DocNo, TrnDate, AccountID, Supplier ' +
> 'FROM TRNPOH ' +
> 'WHERE AccountID IN (' + @AcctList + ')'
>
>EXECUTE(@Sql)
>GO
>
>
>Thanx! in advance!!!
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform