c# - Search a row from a table which starts with asterisk symbol -


I am uploading an excel file using c # and I select the name column from that excel file I am here. A very string in the column starts with the number symbol (*). I need a query to select all the rows. Please help me in this.

I tried the sample code below but it is not working properly. A lot of it is returning, which does not have an icon (*)

  secure void btnUpload_Click (Object Sender, EventArgs E) {// String FilePath = ConfigurationManager.AppSettings ["FilePath"] Upload To get the path from the web.config file. ToString (); String file name = string Empty; // To check if the file is selected or not then uplaod (BrowseFile.HasFile) {try {string [] allowdFile = {".xls", ".xlsx"}; // Here we are only allowing Excel files to verify the selected file PDF, or fileX = System.io.path.gate extension (browse file.posted.file.philname); // Check whether the selected file is valid extension or not, is bool; ValidFile = allowdFile.Contains (FileExt); If (! IsValidFile) {lblMsg.ForeColor = System.Drawing.Color.Red; LblMsg.Text = "Please upload only excel"; } Else {// Get the size of the uploaded file, here limits file int file size = BrowseFile.PostedFile.ContentLength; If (FileSize & lt; = 1048576) // 1048576 byte = 1MB {// File name of the selected file file name = path. GetFileName (Server.MapPath (BrowseFile.FileName)); // Browse the selected file in the server location BrowseFile.SaveAs (Server.MapPath (FilePath) + filename); // File Path String File Get Path = Server.MapPath (FilePath) + Filename; // Open connection with Excel file based on Axle version OleDbConnection con = null; If (FileExt == ".xls") {con = new OleDbConnection (@ "Provider = Microsoft.Jet.OLEDB.4.0; Data Source =" + FilePath + "; Extended Properties = Excel 8.0;); } Else if (FileExt == ".xlsx") {con = new OleDbConnection (@ "Provider = Microsoft.ACE.OLEDB.12.0; Data Source =" + FilePath + "; Extended Properties = Excel 12.0;"); } Con.Open (); // Excel Sheet DataTable DT = Context Get a list of sheets available in the Get OLEDBSKTable (OLEDBSKamide TBB, blank); // First get the name of the sheet StringAxcelasset name = dt.rows [0] ["Table_Name"]. ToString (); // Select the rows in the first sheet in the Axle Sheet and fill in the dataset // OLDB commands Excel command = new OLEDB COMMAND (@ "Select Lot F [[+ + + + Excel Assignment + @"] where there is not much ", Con); OleDbCommand ExcelCommand = new OleDbCommand (@ "SELECT lOT FROM [" + getExcelSheetName + @ "] where love '**'", con); OleDbDataAdapter ExcelAdapter = new OleDbDataAdapter (ExcelCommand); Detatale ExcelDataSet = new Detatail () ; ExcelAdapter.Fill (ExcelDataSet); // Holding list in the list of data & lt; DataRow & gt; StrLot = ExcelDataSet.AsEnumerable (.); ToList (); con.Close (); // string lots = ""; // To separate each other with a comma separated separator (int i = 0; i  

You can use the preferred operator

WHERE & lt; Columns & gt; Your data can be changed from the source based on the wildcard '*' to '%', such as '\ **'

and 'LIKE' with keyword 'ALIKE'

with '% ' will be replaced by ' \ ** '

Instead of editing, ' *% 'will become: .xls and below with .xlsx files code

  Oledb Command Excel Konmmand = new Oledibi Command (@ "Select Lot F [[+ Aksesel Shitnam + @"] Where's a lot like '*%' ", Co );  

glad to help! Please remember to accept it if you find it helpful met.


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -