Variable visits Oracle Digital research ing

Source: Internet
Author: User

method, adjust

 PublicDataTable Sayhi (stringSQL, DateTime begintime, DateTime endtime,string[,] array,stringBtime,stringdtime) {                stringConstr =@"Data source= (description= (address= (protocol=tcp) (host=10.93.64.242) (port=1521)) (Connect_data= (SERVER= Dedicated) (service_name=wmstest)); User Id=asrs; Password=asrs123"; OracleConnection Con=NewOracleConnection (CONSTR); //Number of processors--Removing empty numbers                intCount =0;  for(inti =0; I < array. GetLength (0); i++)                {                    if(Array[i,1] !=NULL) {Count++; }} ArrayList Al=NewArrayList (); ArrayList ar=NewArrayList ();  for(inti =0; I < count; i++)                {                    if(Array[i,1] !=string. Empty) {al. ADD (Array[i,0]); Ar. ADD (Array[i,1]); }                }                string[,] ALR =New string[Al. Count,2];  for(intm =0; M < ALR. GetLength (0); m++) {alr[m,0] = (string) al[m]; Alr[m,1] = (string) ar[m]; }                Try                {  //Variable Valuecon.                    Open (); Oracleparameter[] Myparamarray=NewOracleparameter[alr. Length +2]; OracleCommand command=Neworaclecommand (sql, con); OracleDataAdapter da=NewOracleDataAdapter (); stringCcbtime =@":"+btime; stringCcdtime =@":"+Dtime; myparamarray[0] =NewOracleParameter ("Ccbtime", Oracletype.datetime); myparamarray[0]. Value =Endtime; Command. Parameters.Add (myparamarray[0]); myparamarray[1] =NewOracleParameter ("Ccdtime", Oracletype.datetime); myparamarray[1]. Value =BeginTime; Command. Parameters.Add (myparamarray[1]);  for(intj =2; J < ALR. GetLength (0); J + +)                    {                        stringCcstr =@":"+ Alr[j,0]; MYPARAMARRAY[J]=NewOracleParameter (Ccstr, Oracletype.varchar, -); MYPARAMARRAY[J]. Value= Alr[j,1]; Command.                    Parameters.Add (Myparamarray[j]); } da. SelectCommand=command; DataTable DT=NewDataTable (); Da.                    Fill (DT); returnDT; }                Catch(Exception e) {MessageBox.Show ("Abnormal"+e.message); return NULL; }                finally{con.                Close (); }            }


int arr = 0; string[,] array = new STRING[10, 2]; String btime = "Screatdate"; Definition time Variable value string dtime = "Sdate"; String sql = string. Format (@ "SELECT * from Student where 1=1 and Sdate<=to_date (: Sdate, ' Yyyy/mm/dd hh24:mi:ss ') and screatdate>to_date (: Screatdate, ' yyyy/mm/dd hh24:mi:ss ') ");            String sno = TextBox1.Text.Trim (); String sname = TextBox2.Text.Trim (); string sage = TextBox3.Text.Trim (); DateTime beginTime = datetimepicker1.value; DateTime endTime = datetimepicker2.value; if (sno = "") {SQL + = string. Format ("and SNO =:sno"); Array[arr, 0] = "SNO"; Array[arr, 1] = SNO; arr++;} if (sname! = "") {sq L + = string. Format ("and Sname=:sname"); Array[arr, 0] = "SNAME"; Array[arr, 1] = SNAME; arr++;} if (Sage! = "" 
                      
                       ) {SQL + = string. Format ("and Sage=:sage"
                       ); Array[arr, 0] = "Sage"; Array[arr, 1] = sage; arr++;} mymothed mm = new mymothed (); datagridview1.datasource = mm. Sayhi (SQL, BeginTime, endTime, array, btime, dtime);     
                           


Variable visits Oracle Digital research ing

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.