Click here to Skip to main content
15,921,959 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
public OleDbDataReader SqlFindColomnName(string s2)
{
    con.Close();
    con.Open();           
    cmd = new OleDbCommand("select classname, CASE WHEN 
    subject1 = '" + s2 + "' THEN 'subject1' WHEN 
    subject2 = '"       +       s2 + "' THEN 'subject2' WHEN 
    subject3 = '" + s2 + "' THEN 'subject3' END AS Subject
    from studentregistration", con);
    OleDbDataReader rd = cmd.ExecuteReader();
    return rd; 
}

it gives an error like this...
IErrorInfo.GetDescription failed with E_FAIL(0x80004005).
Posted
Updated 7-Jun-10 22:01pm
v2

Hi,

This seems to happen when you use a access reserved word in your query statement.

I suspect the word "classname" which might be creating trouble. Try putting braket around it.

Example:

select [classname], CASE .....

Please refer here for more ..[http://bytes.com/topic/visual-basic-net/answers/353905-ierrorinfo-getdescription-failed-e_fail-0x80004005-why-im-i-getting]

Hope it helps you,
 
Share this answer
 
Comments
suzeets 9-Jun-10 5:46am    
thanx!!!!! buddy..........
Hello there,

Couple of issues with your query

syntax for case could be something like - please review.
- CASE WHEN X=True THEN Y End
- CASE WHEN X=True Then Y ELSE Z End
- CASE WHEN X=True Then Case WHEN Y=True Then Z End End

Also I am not sure how well CASE is implemented in Access you might consider using the IIF statement; using above example, it would be something like

- IIF(X=True, Y)
- IIF(X=True,Y, Z)
- IIF(X=True,IIF(Y=True,Z))

Hope this helps you out.
 
Share this answer
 
Comments
suzeets 9-Jun-10 5:46am    
thank buddy......

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900