Skip to content
Advertisement

SQL Insert Query Using C#

I’m having an issue at the moment which I am trying to fix. I just tried to access a database and insert some values with the help of C#

The things I tried (worked)

A new line was inserted and everything worked fine, now I tried to insert a row using variables:

Didn’t work, no values were inserted. I tried one more thing

May anyone tell me what I am doing wrong?

Kind regards

EDIT:

in one other line I was creating a new SQL-Command

Still not working and I can’t find anything wrong in the code above.

Advertisement

Answer

I assume you have a connection to your database and you can not do the insert parameters using c #.

You are not adding the parameters in your query. It should look like:

Updated:

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement