ket0ma ket0ma - 4 months ago 8
SQL Question

SqlCeExeption was not handled [ [ Token line number = 1,Token line offset = 36,Token in error = WHERE ]]

I am trying to update my SQLcompact database with the following Code:

string sqlquery = ("UPDATE Kunde SET FirmenNr@FirmenNr WHERE KundenNr=@KundenNr");
SqlCeCommand cmd = new SqlCeCommand(sqlquery, cn);
cmd.Parameters.AddWithValue("@FirmenNr", RaumNr);
cmd.Parameters.AddWithValue("@KundenNr", Int32.Parse(KundenNr));
cmd.ExecuteNonQuery();


When I try to debug it the error:(Sorry for German error message)

Fehler beim Analysieren der Abfrage. [ Token line number = 1,Token line offset = 36,Token in error = WHERE ]

appears.

What am I doing wrong?
Does anyone have a solution for my problem?

Answer

There's no = between FirmenNr and the parameter, make it so:

UPDATE Kunde SET FirmenNr = @FirmenNr WHERE KundenNr = @KundenNr;
Comments