Rate this:
See more:
i have a barcode 41/3/100 ,

100 will be saved in data base when i scan barcode with scanner it will read 41/3/100 when i click the button how should i search the record only with 100 using c# code????

help
Posted 14-Nov-12 10:50am
ryanb31 at 14-Nov-12 16:51pm

I don't fully understand your question but if you want to find the data in SQL just use WHERE field LIKE '%100'.

Rate this:

## Solution 4

You can try...

```string keyword = textbox.Text;
var substring = keyword.Split('/');

var dbSaveString = substring[substring.Length - 1];
```
Rate this:

## Solution 1

ryan is right, if it's a string, you can use a LIKE clause. If it's a digit, you will have to write SQL that turns it in to a string so you can use a LIKE clause ( assuming that works ). Otherwise, you're stuck. One possibility, if you were searching for 351, you could do where x % 1000 = 351. That would be if you divide x by 1000, 351 is the remainder. so if you were searching for a two digit number, it would be % 100, etc.

Having looked again, you're clearly storing a string, so searching x LIKE '%100' is what you need.
v2
Mathlab at 14-Nov-12 17:39pm

You can do it using LINQ but its a little long
Christian Graus at 14-Nov-12 17:40pm

Well, it's about the same, but as he's only got a string, all he needs is LIKE. Which is sad, I was kind of proud of my solution for digits :-)
Rate this:

## Solution 2

in my process i am using sql server 2008 r2 and 41/3/ is fixed and the value 100 will increment and only from 100 will save in database
like
100
101
102
103 so on

but for the barcode it will get
41/3/100
41/3/101
41/3/102
so onn...

when they scan with barcode scanner 41/3/102 or some thing in text box when they click search button how should i search with only 102 ???/
Rate this:

## Solution 3

Hi,

Use the below code snippet into your search method.

string keyword = textbox.Text.SubString(textbox.Text.IndexOf("41/3/"));

and use keyword in your where condition.