4

I am struggling to pass though parameter to a stored procedure I have written.

I’m really not sure what I am doing wrong here, but I’m struggling to get VB to pass parameters to SQL Server.

enter image description here

enter image description here

I am setting the @m_id above??

2
  • 1
    Can you post all the code in the file that is throwing the exception? It appears you have a different command (cmd3) being built when an exception happens, which is not the ideal way to handle the logic to build different commands. Using structured exception handling to control logic flow in your application is asking for trouble. Commented Jul 8, 2013 at 15:03
  • @karl Thanks, i will look to touch that up now, i also agree that the flow is asking for trouble. It is working now thanks to George Johnston answer below, but i will neaten up and order the code. Commented Jul 8, 2013 at 15:10

1 Answer 1

7

I would go out on a limb (because I don't see it in the above code) and say it's because you didn't set the cmd2.CommandType to StoredProcedure. By default, the command type is Text, which is used for inline SQL.

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

Comments

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.