Problem Updating to Access Database

I wrote this for a program I'm working on.

static OleDbCommand CreateDataAdapterUpdateCommand()

{

string strSQL;

strSQL = "UPDATE [Player] SET Sweater = '?', First Name = '?', Last Name = '?', Position = '?' WHERE Sweater = '?' AND First Name = '?' AND Last Name = '?' AND Position = '?';";

OleDbCommand cmd = new OleDbCommand(strSQL, dbConn);

OleDbParameterCollection pc = cmd.Parameters;

pc.Add("Sweater_New", OleDbType.BSTR, 0, "Sweater");

pc.Add("First_Name_New", OleDbType.BSTR, 0, "First Name");

pc.Add("Last_Name_New", OleDbType.BSTR, 0, "Last Name");

pc.Add("Position_New", OleDbType.BSTR, 0, "Position");


OleDbParameter param;

param = pc.Add("Sweater_Orig", OleDbType.BSTR, 0, "Sweater");

param.SourceVersion = DataRowVersion.Original;

param = pc.Add("First_Name_Orig", OleDbType.BSTR, 0, "First Name");

param.SourceVersion = DataRowVersion.Original;

param = pc.Add("Last_Name_Orig", OleDbType.BSTR, 0, "Last Name");

param.SourceVersion = DataRowVersion.Original;

param = pc.Add("Position_Orig", OleDbType.BSTR, 0, "Position");

param.SourceVersion = DataRowVersion.Original;

return cmd;

}

And I get this Error message.

Syntax Error (Missing Operator) in query expression 'Sweater = ? AND First Name = ? AND Last Name = ? AND Position = ?'

I can't for the life of me figure out what's wrong. Any ideas?

Thanks in advance,

Ealdormere




Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories