I want to know if the next piece of code is correct:
SqlCommand cmd = new SqlCommand(
"IF NOT EXISTS(SELECT count(*) from Raspunsuri where id_intrebare=2)" +
"Insert INTO Raspunsuri VALUES(@raspuns,@cnp,@data,2,@ip,@idsesiune)" +
"else" +
"UPDATE Raspunsuri SET raspuns=@raspuns,cod_numeric_personal=@cnp,data_raspuns=@data,id_intrebare=2,ip_user=@ip,id_sesiune=@idsesiune WHERE id_intrebare=2", con);
All the parameters are correct that I want to insert but it seems this piece of code doesn’t do the insert or update.Do you have any suggestions?it’s a sql query combined with c#..
Inspect the string that’s created by that command: some words need spaces between them.