Link to home
Start Free TrialLog in
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"  />
Avatar of Sirees

Try this

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


nvarchar is not a valid type in
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
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.
Avatar of Anthony Perkins
Anthony Perkins
Flag of United States of America image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial