The verification number is automatically generated in this table, and is irrelevant to other tables.
Effect:
Description: numbers are automatically generated in this table, and are irrelevant to other tables.
Call:
1 Protected Void Page_load ( Object Sender, eventargs E) 2 { 3 Response. expires =- 1 ; 4 If (! Ispostback) 5 { 6 If (Actiontype = Commonenum. actionlevel. Write) 7 { 8 Tbsybh. Text = Getsybh (); 9 } 10 } 11 }
1 Protected StringGetsybh ()2 {3StringGetsybh = commonfunction. getbymenucode (thispositionid,"Hxty_lydj","Sybh",5);;4ReturnGetsybh;5}
FunctionCode:
1 Public Static String Getbymenucode ( String Thispositionid, String Tablename, String Rowname, Int DIGIT) 2 { 3 String Getcode = String . Empty; 4 String Title = String . Empty; 5 String SQL = String . Format ( " Select max (right ({0 }, " + Digit + " ) + 1) as rowname, left (max ({0}), Len (max ({0 }))- " + Digit + " ) As rowtitle from {1} " , Rowname, tablename ); 6 Dbcommand sqlcommand = Erpdatabase. erpdb. getsqlstringcommand (SQL ); 7 Dataset dsdata = New Dataset (); 8 Erpdatabase. erpdb. loaddataset (sqlcommand, dsdata, " Data " ); 9 If (Dsdata. Tables [ " Data " ]. Rows. Count> 0 ) 10 { 11 Datarow ROW = dsdata. Tables [ " Data " ]. Rows [ 0 ]; 12 If (Row [ " Rowname " ] = Dbnull. value) 13 { 14 Getcode = " 1 " ; 15 Getcode = getcode. padleft (digit, ' 0 ' ); 16 } 17 Else 18 { 19 String Second = row [ " Rowname " ]. Tostring (); 20 Getcode = second. padleft (digit,' 0 ' ); 21 } 22 If (Row [ " Rowtitle " ]! = Dbnull. value) 23 { 24 Title = row [ " Rowtitle " ]. Tostring (); 25 } 26 } 27 Return Title + Getcode; 28 }