1

I have the following sql code in vb.net :

    opdragkopieernaleweringresultaat.CommandText = "insert into    LeweringVsSkattingResultaat(aliasnaam2,kultivar2,skattingkultivar2,gelewerkultivar2,persentklaarkultivar2) " & _
     "  SELECT " & _
     "l.aliasnaam() " & _
     ",l.kultivar,l.SkattingVirKult,l.GelewerVirKult,l.PersentKlaarKult " & _
     " FROM() " & _
     "LeweringVsSkatting l " & _
     " GROUP BY " & _
     " l.aliasnaam() " & _
     ",l.kultivar,l.SkattingVirKult,l.GelewerVirKult,l.PersentKlaarKult"
    opdragkopieernaleweringresultaat.ExecuteNonQuery()

The code works in sql management, but returns the following error in vb.net : Incorrect syntax near ')'. The error occurs at the line opdragkopieernaleweringresultaat.ExecuteNonQuery(). What am I missing?

Regards

1
  • 2
    Remove the use of () in your statement. Commented Feb 11, 2017 at 17:47

1 Answer 1

2

When you copied the SQL to vb the IDE added the () marks at the end of some of the rows due to its "intelligence". Remove them and it should work as expected.

enter image description here

Sign up to request clarification or add additional context in comments.

3 Comments

Thank you Trevor. I did not even notice that.
@Gideon : You have only voted twice and barely accepted any of the answers on your 25 questions that has gotten at least one answer. You ought to upvote if you find a post helpful, and definitely accept an answer that solved your problem. It is a way of showing your gratitude to those who take their time trying to help you.
@Gideon Not a single answer accepted in the last year and 2 votes ever is rather sparse. If you are not in a position to help others by answering questions, you can still help by upvoting any post you find informative and accepting answers. UpVotes and Accepts helps others find good answers.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.