Как ввести несколько текстов для поиска в одном текстовом поле.
Я хочу искать несколько, используя только одно текстовое поле, возможно ли это?
например, я хочу, чтобы ввод 20712 20713 20714 20715 в моем текстовом поле был поисковым и просматривал его в datagridview. ТИА
Пожалуйста, смотрите ниже запрос ниже, который я использовал для отображения данных в моем datagridview.
Что я уже пробовал:
string TurNum = txtTurName.Text; try { if (TurNum == "") { MessageBox.Show("Please Eneter SCADA ParkName"); } else if (TurNum == txtTurName.Text) { ConnVDC.openConnection(); ConnVDC.sql = ("SELECT DISTINCT t2.turbinenumber, gdcipaddress AS TurbineIPAddress, parkname, t2.sbuname AS Region, t2.countryname_park, t2.scadaparkname, t2.scadaipaddress, t2.datacentername, t2.parkgeographicaltimezoneindex, t2.sapfunctionallocation, t2.highestcontract, t2.turbinename, newestvmp10mindatalocal, newesttac10mindatalocal, newestolt10mindatalocal, CASE WHEN newestvmp10mindatalocal IS NULL THEN Datediff(day, newesttac10mindatalocal, Getdate()) WHEN newestvmp10mindatalocal IS NOT NULL THEN Datediff(day, newestvmp10mindatalocal, Getdate()) end AS[No: of days], CASE WHEN newestvmp10mindatalocal IS NULL AND Datediff(day, newesttac10mindatalocal, Getdate()) > 90 THEN '> 90 days' WHEN newestvmp10mindatalocal IS NOT NULL AND Datediff(day, newestvmp10mindatalocal, Getdate()) > 90 THEN '> 90 days' WHEN newestvmp10mindatalocal IS NULL AND Datediff(day, newesttac10mindatalocal, Getdate()) < 1 THEN 'Uptodate' WHEN newestvmp10mindatalocal IS NOT NULL AND Datediff(day, newestvmp10mindatalocal, Getdate()) < 1 THEN 'Uptodate' WHEN newestvmp10mindatalocal IS NULL AND Datediff(day, newesttac10mindatalocal, Getdate()) < 3 THEN '1 - 2 days' WHEN newestvmp10mindatalocal IS NOT NULL AND Datediff(day, newestvmp10mindatalocal, Getdate()) < 3 THEN '1 - 2 days' WHEN newestvmp10mindatalocal IS NULL AND Datediff(day, newesttac10mindatalocal, Getdate()) < 8 THEN '3 - 7 days' WHEN newestvmp10mindatalocal IS NOT NULL AND Datediff(day, newestvmp10mindatalocal, Getdate()) < 8 THEN '3 - 7 days' WHEN newestvmp10mindatalocal IS NULL AND Datediff(day, newesttac10mindatalocal, Getdate()) < 16 THEN '8 - 15 days' WHEN newestvmp10mindatalocal IS NOT NULL AND Datediff(day, newestvmp10mindatalocal, Getdate()) < 16 THEN '8 - 15 days' WHEN newestvmp10mindatalocal IS NULL AND Datediff(day, newesttac10mindatalocal, Getdate()) < 31 THEN '16 - 30 days' WHEN newestvmp10mindatalocal IS NOT NULL AND Datediff(day, newestvmp10mindatalocal, Getdate()) < 31 THEN '16 - 30 days' WHEN newestvmp10mindatalocal IS NULL AND Datediff(day, newesttac10mindatalocal, Getdate()) < 61 THEN '31 - 60 days' WHEN newestvmp10mindatalocal IS NOT NULL AND Datediff(day, newestvmp10mindatalocal, Getdate()) < 61 THEN '31 - 60 days' WHEN newestvmp10mindatalocal IS NULL AND Datediff(day, newesttac10mindatalocal, Getdate()) < 91 THEN '61 - 90 days' WHEN newestvmp10mindatalocal IS NOT NULL AND Datediff(day, newestvmp10mindatalocal, Getdate()) < 91 THEN '61 - 90 days' end AS[Period of Days], newestturbineeventlocal, parkname, t2.sbuname, t2.countryname_park, t2.maincontrollername, t2.datacentername, t2.soayieldcalculationstart, t2.soayieldcalculationend, t2.warrantyinservicecontractstart, t2.warrantyinservicecontractend, t2.oldserialnumber FROM fct.turbinehasdata t1 INNER JOIN dim.turbine t2 ON t1.dt1turbineid = t2.dt1turbineid WHERE Getdate() BETWEEN t2.validfrom AND t2.validto AND t2.turbinenumber IN ('" + TurNum +"')"); ConnVDC.cmd.CommandType = CommandType.Text; ConnVDC.cmd.CommandText = ConnVDC.sql; ConnVDC.da = new SqlDataAdapter(ConnVDC.cmd); ConnVDC.dt = new DataTable(); ConnVDC.da.Fill(ConnVDC.dt); myDataGrid.AutoGenerateColumns = true; myDataGrid.ItemsSource = ConnVDC.dt.DefaultView; ConnVDC.closeConnection(); MessageBox.Show("If park is not yet added in GDA Servers. ScadaParkname, SCADAIPaddress and datacenter should be a Null value (N/A)", "Note"); } } catch (Exception ex) { MessageBox.Show("The System failed to establish a connection." + Environment.NewLine + "Descriptions: " + ex.Message.ToString(), "SQL Server Connectivity Issue"); }