Accumulate by bit [C #]-check numbers are automatically generated in this table, and are irrelevant to other tables

Source: Internet
Author: User

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 }

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.