Monday, May 24, 2010

Error deleting record on Excel using C# code, under Microsoft Expression Web. Please Help. Here is my code:?

When I view my web page there's no error that prompts and I can even click my delete button, but when I open my Excel sheet the data is still there. I need your suggestion.





public void delete_Click(Object Src, EventArgs E)


{


string connectionString;





connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" +


@"Data Source=C:\Documents and Settings\ojt04\My Documents\mySit\payroll\database\profile... +


"Extended Properties=Excel 8.0;";


OleDbConnection connA = new OleDbConnection(connectionString);


connA.Open();


OleDbCommand command1 = new OleDbCommand("DELETE FROM [profilesheet$](FirstName) WHERE IDNo=txtid.Text",connA);


connA.Close();


txtid.Text="";


txtfname.Text="";


txtlname.Text="";


txtmname.Text="";


txtadd.Text="";


txtbday.Text="";


txtcontact.Text="";


txtposition.Text="";


txtdept.Text="";





}

Error deleting record on Excel using C# code, under Microsoft Expression Web. Please Help. Here is my code:?
You don't seem to be getting any help so I will just ask if you know whether the statement





connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" +


@"Data Source=C:\Documents and Settings\ojt04\My Documents\mySit\payroll\database\profile... +


"Extended Properties=Excel 8.0;";





needs a continuation character at the end of the second line and perhaps and end quote before it and an opening quote the start line 3?





If I am wrong, just give this answer a thumbs down and I will remove it to increase (however slightly) your chances that someone else will provide and answer.


No comments:

Post a Comment