C # access SQLQueryDateOfCode! Note: In ACCESS, the Date type is like the length.DateType Private void FindButton_Click (object sender, EventArgs e) { OleDbConnection con = new OleDbConnection (dbConnetion. connetion); // There is a special data opening class in dbConnetion. cs. String reverse STR; If (Hour = 0) { Explain STR = "select * from MeteorologyData where Date =" + this. FindDate. ToOADate (); } Else { Explain STR = "select * from MeteorologyData where Date =" + this. FindDate. ToOADate () + "and Time =" + Hour; } Con. Open (); OleDbDataAdapter adp = new OleDbDataAdapter (reverse STR, con ); Ds = new DataSet (); Ds. Clear (); Adp. Fill (ds ); String [] mytitle = {"Date"," Time period "," effective visibility "," sea level visibility "," weather phenomenon "," total cloud volume "," medium and low cloud volume "," low cloud volume ", "Cloud code", "Cloud", "wind direction", "Wind Speed", "temperature", "absolute humidity", "relative humidity", "Dew Point", "pressure on this site ", "sea level pressure", "precipitation", "wave", "recorder number "}; For (int I = 0; I { Ds. Tables [0]. Columns [I]. ColumnName = mytitle [I]; } DataGridView1.DataSource = ds. Tables [0]. DefaultView; // DataGridView1.Capture = "Total" + ds. Tables [0]. Rows. Count. ToString () + "record "; Con. Close (); } Article:C # access SQLQueryDateOfCode! Address: http://www.verydemo.com |