-1

My database is like this:

Numbers | Names | Surnames
59266558 | John | Smith
56358656 | Ann | Joyle
59266558 | George| Colbyn
59266558 | Gregor| Leon

As you can see, I have no ID field. So, the question is, how can I select "Ann Joyle" ( with index 1), or "Gregor Leon" with index 3), and copy his/her number to `textBox` in C#?

Slava Vedenin
  • 58,326
  • 13
  • 40
  • 59
midler
  • 7
  • 4

1 Answers1

-1

If You want to have number by first name and surname from table this is simple:

 SELECT Numbers WHERE Names= "Ann" and Surnames ="Joyle"

You get what You want.

If You want special index You can use in SQLLite syntax like this:

SELECT Numbers,Names,Surnames  WHERE LIMIT 1 OFFSET 1

It is mean take 1 row and skip 1 row is equivalent to take index 1.

More info here: Sqlite LIMIT / OFFSET query

BUT

Your SQL table are unordere and the result of this query may be difrrent when You change something.

Good to do is use SQL ORDER BY keyword

SELECT Numbers,Names,Surnames  WHERE ORDER BY Surnames LIMIT 1 OFFSET 1
Community
  • 1
  • 1
blogprogramisty.net
  • 1,714
  • 1
  • 18
  • 22