Recently, the Entity Framework 4.1 and LINQ frameworks were used for development. However, the primary key values in the Oracle data table use sequence generation auto-increment values, when adding a record, you must query and obtain the Sequence Value of the current table.
Query sequence method:
View code
Public Decimal getproblemxh () {decimal maxxh = 90000000 ; Using (Modulezjkentities entity = New Modulezjkentities () {string strdbtype = (System. Data. entityclient. entityconnection) (entity. Connection). storeconnection. tostring (); If (Entity! = Null ){ String Strseqidquerysql; If (Strdbtype = " System. Data. sqlclient. sqlconnection " ) {Strseqidquerysql = " Insert into dual (newdate) values (getdate () Select @ identity " ;} Else {Strseqidquerysql = " Select sqe_zj_fywt.nextval from dual " ;} Decimal decseqid = Entity. executestorequery <decimal> (Strseqidquerysql). First (); maxxh = Decseqid ;}} Return Maxxh ;}
In the next step, we will study how to call the stored procedure. If you have any good methods, we hope to share them with you ~~~