A
Anon
Hi all.
My question, basically, is: if I do this, am I open to a sql injection
attack?
DataAdapter.SelectCommand = new SqlCommand("SELECT * FROM Users WHERE
UserId = 1",ConnectionObject) //Let's assume for a moment that that
sql string is not dynamically constructed and not susceptible.. I am
asking more about what comes next..
SqlCommandBuilder CmdBuilder = new SqlCommandBuilder (DataAdapter);
DataAdapter.UpdateCommand = CmdBuilder.GetUpdateCommand();
DataSet ds = new DataSet();
DataAdapter.Fill(ds,"mytable");
ds.tables[0].Rows["Name"] = MALICIOUS SQL INJECTION ATTEMPT; // let's
say this is where the end user could slip malicious string he wanted
into
DataUpdater.Update(ds);
if (ds.haschanges)
{
ds.AcceptChanges();
}
I'm hoping that the fact that DataAdapter.UpdateCommand is essentially
a parameterized sql string that an attempted sql injection attack
placed into here: ds.tables[0].Rows["Name"] would always fail.
Is that right or am I wide open here?
Thank you in advance for your help and I look forward to hearing from
anyone who knows the answer to this..
Regards,
Jeff
My question, basically, is: if I do this, am I open to a sql injection
attack?
DataAdapter.SelectCommand = new SqlCommand("SELECT * FROM Users WHERE
UserId = 1",ConnectionObject) //Let's assume for a moment that that
sql string is not dynamically constructed and not susceptible.. I am
asking more about what comes next..
SqlCommandBuilder CmdBuilder = new SqlCommandBuilder (DataAdapter);
DataAdapter.UpdateCommand = CmdBuilder.GetUpdateCommand();
DataSet ds = new DataSet();
DataAdapter.Fill(ds,"mytable");
ds.tables[0].Rows["Name"] = MALICIOUS SQL INJECTION ATTEMPT; // let's
say this is where the end user could slip malicious string he wanted
into
DataUpdater.Update(ds);
if (ds.haschanges)
{
ds.AcceptChanges();
}
I'm hoping that the fact that DataAdapter.UpdateCommand is essentially
a parameterized sql string that an attempted sql injection attack
placed into here: ds.tables[0].Rows["Name"] would always fail.
Is that right or am I wide open here?
Thank you in advance for your help and I look forward to hearing from
anyone who knows the answer to this..
Regards,
Jeff