mercredi 3 juin 2015

C# to SQLite Email String

Trying to store an email address from a .NET application into a SQLite database. The DB is pre-built within the SQLite studio and I have already connected my project to it.

Problem is, when I attempt to pass an email address (String), into the DB with the following:

Account.Email = test@test.com
string SQLText = "INSERT " + "INTO Account (Email) " + "VALUES (" + Account.Email + ")"
SqliteCommand Command = new SQLiteCommand (SQLText, Base);
Command.ExecuteNonQuery ();

Account being a class that holds the email string and Base being a reference to the DB with C#.

I get

SQLiteSyntaxException: near "@Test": syntax error

What should I do to the string in order for it to ignore the @ as a parameter declaration in sql?

Any advice?

Sean

Aucun commentaire:

Enregistrer un commentaire