Roy M
Roy M

Reputation: 1

update SQL command in C#

I'm having some troubles parsing SQL query, I'm trying to update the database. I have a database as follows:

name: Users
columns:
ID (int)
userName (string)
LastConnected (string)
isConnected (string)

I tried this:

SqlCeCommand upDateUserAsConnected = new SqlCeCommand("(update Users set isConnected='Connected' where ID=" + userID + " and userName='"+userName+"')", cn);

and that's not working... what did I do wrong?

Upvotes: -3

Views: 96

Answers (1)

Rabbiya Shahid
Rabbiya Shahid

Reputation: 422

First of all you don't need parentheses within the query string. Second of all, you have merely written the query here, have you tried to execute it as non-query? How exactly are you running this query?

Upvotes: 0

Related Questions