Click here to Skip to main content
14,302,627 members
Rate this:
Please Sign up or sign in to vote.
See more:
How can i resolve this error. I had tried using this link but not working.

https://stackoverflow.com/questions/17739612/new-line-in-constant-error

What I have tried:

dtListBox = dLib.GetDataTable("declere @test table(SLNControl int,ControlOrderBy int) insert into @test values(" + stringData + ")update UIF_ControlProperties set SLNControl= tb.slnControl from @test tb.join UIF_ControlProperties cp on tb.slnControl = sp.SLNControl);
Posted
Updated 14-Mar-19 2:19am
Comments
Maciej Los 14-Mar-19 7:26am
   
What values holds stringData variable?
Maciej Los 14-Mar-19 7:40am
   
In your statement several mistakes occurs:
"declere @test table(SLNControl int,ControlOrderBy int) insert into @test values(" + stringData + ")update UIF_ControlProperties set SLNControl= tb.slnControl from @test tb.join UIF_ControlProperties cp on tb.slnControl = sp.SLNControl);

declere - it should be: declare
")update" - missing space between bracket and update statement
"from @test tb.join UIF_ControlProperties cp on tb.slnControl = sp.SLNControl" - wrong alias!
and finally:
("declere @test ... on tb.slnControl = sp.SLNControl); - missing double quote at the end of statement!
Rate this:
Please Sign up or sign in to vote.

Solution 1

It looks like you are missing a closing double quote at the end of the sql command.

You probably need this

dtListBox = dLib.GetDataTable("declere @test table(SLNControl int,ControlOrderBy int) insert into @test values(" + stringData + ")update UIF_ControlProperties set SLNControl= tb.slnControl from @test tb.join UIF_ControlProperties cp on tb.slnControl = sp.SLNControl");
   
Rate this:
Please Sign up or sign in to vote.

Solution 2

Take a look at your statement:
"declere @test table(SLNControl int,ControlOrderBy int) insert into @test values(" + stringData + ")update UIF_ControlProperties set SLNControl= tb.slnControl from @test tb.join UIF_ControlProperties cp on tb.slnControl = sp.SLNControl);

There's several mistakes:










WrongCorrect
1. wrong syntax:
declere
declare
2. missing space between bracket and update statement
")update"
") update"
3. wrong alias!
"from @test tb.join UIF_ControlProperties cp on tb.slnControl = sp.SLNControl"
"from @test tb.join UIF_ControlProperties cp on tb.slnControl = cp.SLNControl"
4. missing double quote at the end of statement!
("declare ... SLNControl);
("declare ... SLNControl");


But, the worse thing is that you're trying to fetch data when your command is used to modify data instead of select them!
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100