Search using vb.net

Search using vb.net

Page 1 of 1

9 Replies - 10502 Views - Last Post: 21 July 2010 - 09:19 AM Rate Topic: -----

#1 alan025  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 14
  • Joined: 20-July 10

Search using vb.net

Posted 20 July 2010 - 05:33 AM

Hello

I am new to vb.net ..i have created a student details in the database ...
Now i want to retrive the details from the asp.net using search options ie if i searched by entering the name of the student the entire details about the student should be displayed in the front end ..

I would like to display the details of the student in the front in a table ...

waiting for your suggestions

Thank you

Is This A Good Question/Topic? 1
  • +

Replies To: Search using vb.net

#2 modi123_1  Icon User is offline

  • Suitor #2
  • member icon



Reputation: 9287
  • View blog
  • Posts: 34,811
  • Joined: 12-June 08

Re: Search using vb.net

Posted 20 July 2010 - 06:48 AM

View Postalan025, on 20 July 2010 - 06:33 AM, said:

Hello

I am new to vb.net ..i have created a student details in the database ...
Now i want to retrive the details from the asp.net using search options ie if i searched by entering the name of the student the entire details about the student should be displayed in the front end ..

I would like to display the details of the student in the front in a table ...

waiting for your suggestions

Thank you


Here you go:

1. Determine if you want a grid or a set of text boxes to display the detail information.
2. Have a text box and a button for the search.
2.1 User should have data in the search-textbox when the search-button is clicked.
2.2 When the search button is clicked take the data from the search-textbox, use it as a variable to a stored procedure 'get' call to your database. (SQLCommand objects and connection strings)
3. In the database write a stored procedure for 'getting' or querying the database based on an incoming varchar (you determine the length) variable.
3.1 This query would be a pretty basic "select <column names> from <table name> where <input variable name>
4. When the data comes back from the database fill an empty data table or dataset with a data table.
5. Throw that information into the display of choice in #1.
Was This Post Helpful? 0
  • +
  • -

#3 Frinavale  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 203
  • View blog
  • Posts: 776
  • Joined: 03-June 10

Re: Search using vb.net

Posted 20 July 2010 - 06:54 AM

What kind of database are you using?
Do you know how to connect to it and retrieve data from it in VB.NET?

You've posted a pretty vague question and it's hard to find a starting point to help you with.
As modi123_1 suggested, the first step would be to pick controls that you are going to use to retrieve data from the user and controls that you are going to use to display the data.

Then it's just a matter of creating a SQL command that does a SELECT on the database based on the user's search criteria...and display the results.

-Frinny
Was This Post Helpful? 0
  • +
  • -

#4 alan025  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 14
  • Joined: 20-July 10

Re: Search using vb.net

Posted 20 July 2010 - 07:46 AM

Thanks modi for ur valuable suggestions

I have created a Store procedure ..This is working fine when we pass parameters from the database
..........

ALTER PROCEDURE [dbo].[getstudentresultbyname]
-- Add the parameters for the stored procedure here
@StudentName nvarchar(50)
AS
BEGIN

SELECT *from Students
where StudentName LIKE '%'+@StudentName+'%'

END

...........
....

Also could u guide me more with points 2.2 and 5 ... i am able to retrive data from the front end by using a textbox and declaring an ID in them, and it is retriving the searched datas from the database in that textbox .. that is working fine

Now i want to display data in a table ie the entire details about the particualr student in a table format ..

Hope u are clear with my query

thank you

View PostFrinavale, on 20 July 2010 - 05:54 AM, said:

What kind of database are you using?
Do you know how to connect to it and retrieve data from it in VB.NET?

You've posted a pretty vague question and it's hard to find a starting point to help you with.
As modi123_1 suggested, the first step would be to pick controls that you are going to use to retrieve data from the user and controls that you are going to use to display the data.

Then it's just a matter of creating a SQL command that does a SELECT on the database based on the user's search criteria...and display the results.

-Frinny



thank you frinvale

I am using SQL as database amd connected the front end via Linq

thank you

This post has been edited by alan025: 20 July 2010 - 07:45 AM

Was This Post Helpful? 0
  • +
  • -

#5 modi123_1  Icon User is offline

  • Suitor #2
  • member icon



Reputation: 9287
  • View blog
  • Posts: 34,811
  • Joined: 12-June 08

Re: Search using vb.net

Posted 20 July 2010 - 08:26 AM

View Postalan025, on 20 July 2010 - 08:46 AM, said:

Thanks modi for ur valuable suggestions

I have created a Store procedure ..This is working fine when we pass parameters from the database
..........

ALTER PROCEDURE [dbo].[getstudentresultbyname]
-- Add the parameters for the stored procedure here
@StudentName nvarchar(50)
AS
BEGIN

SELECT *from Students
where StudentName LIKE '%'+@StudentName+'%'

END

For the love of Saint Peter - do not use Select *. Qualify those column names lest you add a column and your dataset isn't updated to catch it.

View Postalan025, on 20 July 2010 - 08:46 AM, said:

Also could u guide me more with points 2.2

Here's the MSDN examples on using sql command with a data reader.

http://msdn.microsof...v=VS.71%29.aspx


View Postalan025, on 20 July 2010 - 08:46 AM, said:

and 5 ...


Create a dataset object in your solution.
Open it up
Right click in the designer and 'create a table'.
Make sure the columns match what you are returning from the stored procedure.
Save.. build.
In your form plunk a grid down.
In your form click on your dataset object (toolbox) and plunk that down in your form's designer.
In your grid set the data source property to your dataset object's name.
In your grid set the data member property to your dataset's table name (there's a drop down).

As long as your datareader from the example above is filling your dataset's table... Bob's your uncle!
Was This Post Helpful? 0
  • +
  • -

#6 alan025  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 14
  • Joined: 20-July 10

Re: Search using vb.net

Posted 21 July 2010 - 12:22 AM

View Postalan025, on 20 July 2010 - 08:46 AM, said:

View Postalan025, on 20 July 2010 - 08:46 AM, said:



Create a dataset object in your solution.
Open it up

is it i want to create dataset in solotion like the way in the article
http://support.microsoft.com/kb/320714

thank you
Was This Post Helpful? 0
  • +
  • -

#7 modi123_1  Icon User is offline

  • Suitor #2
  • member icon



Reputation: 9287
  • View blog
  • Posts: 34,811
  • Joined: 12-June 08

Re: Search using vb.net

Posted 21 July 2010 - 07:24 AM

Sure.. that sounds about right.
Was This Post Helpful? 0
  • +
  • -

#8 alan025  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 14
  • Joined: 20-July 10

Re: Search using vb.net

Posted 21 July 2010 - 08:17 AM

thats nice modi

Also Suppose i am using linq for connecting to database ..how can i retrive from the front through a search options ..is it the same way

could give some suggestions

thank you
Was This Post Helpful? 0
  • +
  • -

#9 modi123_1  Icon User is offline

  • Suitor #2
  • member icon



Reputation: 9287
  • View blog
  • Posts: 34,811
  • Joined: 12-June 08

Re: Search using vb.net

Posted 21 July 2010 - 08:44 AM

I tend to use LINQ only to power-query data I already have.. not so much in terms of pulling it back... though I guess this should help:

http://msdn.microsof...y/bb907138.aspx
Was This Post Helpful? 0
  • +
  • -

#10 alan025  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 14
  • Joined: 20-July 10

Re: Search using vb.net

Posted 21 July 2010 - 09:19 AM

Let me try with the link ..

Thank you
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1