Avatar of PatrickSweeney
 asked on

Incorrect syntax error

I'm getting the following error
Line 1: Incorrect syntax near 'nvarchar'.
Must declare the variable '@ID'.

I ran a trace and the statement is being passed to SQL Server with the parameters, but it is not updating.
Using VB.Net, Asp 2.0, SQL Server 2000.
To me the code seems identical to other forms where it is working fine.

This code:

           UpdateCommand="update [Leads] set  brief_description=@brief_description, value=@value, [status]= @status, decision_date=@decision_date, probability=@probability where id=@id">
                <asp:Parameter Name="Customer_Name" Type="String" />
                <asp:Parameter Name="decision_Date" type="datetime"/>
                <asp:Parameter Name="probability" type="string"/>
                <asp:Parameter Name="brief_description" Type="String" />
                <asp:Parameter Name="value" Type="Decimal" />
                <asp:Parameter Name="status" Type="String" />
                <asp:Parameter Name="ID"  />
Microsoft SQL Server

Avatar of undefined
Last Comment
Anthony Perkins

8/22/2022 - Mon

Try this

 <asp:Parameter Name="ID"  Type = "NVarChar" />

nvarchar is not a valid type in vb.net.
I tried specifyign it as decimal type but that did not fix it.

I experimented by removing the clause "where id=@id"
It returned the incorrect syntax error again anyway
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.

Bizarre error. It still occurs if I reduce the update statement to just
update leads set probability ='50%'.
Must be a problem at the application level - so this post should be on ASP.NET forum I suppose.
Anthony Perkins

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question