hi,
Actually I tried to delete a row from a table(SQL)
using ADO.Net.
This is the function I used:
public int deleterow(string username)
{
try
{
ADOConnection objconn
new ADOConnection("Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=UserAccount;Data
Source=MUMA;");
string strSQL = "select * from UserAccountTable";
ADODataSetCommand dsc = new ADODataSetCommand(strSQL,objconn);
DataSet ds = new DataSet();
dsc.DeleteCommand = new ADOCommand("delete from UserAccountTable where username = '"+username.Trim()+"'",objconn);
dsc.FillDataSet(ds,"UserAccountTable");
Console.WriteLine(ds.Tables["UserAccountTable"].Rows.Count);
return(dsc.Update(ds,"UserAccountTable"));
}
catch(Exception e)
{
Console.WriteLine(e.Message);
}
return 0;
}
The code doesnot throw any exceptions.
But the particular row is not deleted in the Database.
It remains unaffected.
What's wrong with this code? Please correct me...
Thanks.
Regards,
Uma