Question

Locked

Extracting Variable data from Sql server using VB in C#

By stardust_sweeper ·
hi guys, i am working on a project which require me to create a search function which search through my sql database and then display the datas which are selected.

for example
i have a data list with column : name , address, telephone number, age, gender.

i would need to type in the name and then search and display all data with the same name.

since the name that i type into the searchbox is everchanging, how would i be able to put it into the "WHERE NAME =" command of the sql

This conversation is currently closed to new comments.

1 total post (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Answers

Collapse -

Well, basically

by Tony Hopkinson In reply to Extracting Variable data ...

If you had an edit box to take the target name.

A grid to show the answer, bound to a parameterised query.

Then on each change (don't forget to deal with blank entry)
Just set the parameter value to the content of the edit box.

You should not be building sql from user input, look up sql injection.

You would be beter off with like rather than =, that say as the user types, the list narrows down. Of course it you have a lot of data that might get expensive, there are a few ways of dealing with that, from adding a get button and putting the code in it's onclick to paging and even threading.

Back to Networks Forum
1 total post (Page 1 of 1)  

Related Discussions

Related Forums