c# 4.0 - calling oracle stored procedure in c# -
i trying call oracle stored procedure in c# this
odbcdataadapter da = new odbcdataadapter(); da.selectcommand = new odbccommand(); da.selectcommand.connection = con; da.selectcommand.connection.open(); da.selectcommand.commandtext = "kamran.attn"; da.selectcommand.commandtype = commandtype.storedprocedure; da.selectcommand.executenonquery(); da.selectcommand.connection.close(); label3.text = "attendance posted successfully"; but showing error
error [42000] [oracle][odbc][ora]ora-00900: invalid sql statement please 1 can tell missing call procedure.plz !
you try inverse statements:
da.selectcommand.commandtype = commandtype.storedprocedure; da.selectcommand.commandtext = "kamran.attn"; also, maybe try add:
da.selectcommand.parameters.clear(); before
da.selectcommand.commandtype = commandtype.storedprocedure; da.selectcommand.commandtext = "kamran.attn"; i think should use datatable
datatable dt = new datatable(); da.fill(dt); return dt; maybe should oracle data adapter:
oracledataadapter da = new oracledataadapter(); da.selectcommand = new oraclecommand(); so should have:
oracledataadapter da = new oracledataadapter(); da.selectcommand = new oraclecommand(); da.selectcommand.connection = con; da.selectcommand.connection.open(); da.selectcommand.parameters.clear(); da.selectcommand.commandtype = commandtype.storedprocedure; da.selectcommand.commandtext = "kamran.attn"; datatable dt = new datatable(); da.fill(dt); return dt; da.selectcommand.connection.close(); i hope helps in way.
Comments
Post a Comment