473,503 Members | 1,849 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to return multiple at the same time using DataGridView for C#.net

4 New Member
i just the beginner.My db is using MS SQL server 2008
Aug 20 '10 #1
7 1921
benwizzle
72 New Member
I'm not quite sure what your asking. Please elaborate.
Aug 20 '10 #2
MrMancunian
569 Recognized Expert Contributor
1. Write query
2. Execute query
3. Save data in DataTable
4. Bind DataTable to Gridview

Have fun figuring it out!

Steven
Aug 20 '10 #3
benwizzle
72 New Member
If your referring to what Mr.Mancunian just said...i can help you out there.
Aug 20 '10 #4
MengChee
4 New Member
i doing a website that need to handle the search result. becoz normal the label just can handle one result. so the datagridview can solve this problem but how to implement it?
Aug 21 '10 #5
MrMancunian
569 Recognized Expert Contributor
See my first post:

1. Write query
2. Execute query
3. Save data in DataTable
4. Bind DataTable to Gridview

Steven
Aug 23 '10 #6
benwizzle
72 New Member
General this is how i do query's in asp.net.
First you must make sure you load the assembly to your page.
Expand|Select|Wrap|Line Numbers
  1. using System.Data.SqlClient;
  2.  
Then declare a connection, command, datatable, and a dataadapter.
Expand|Select|Wrap|Line Numbers
  1. SqlConnection con = new SqlConnection("connectionstring");
  2. SqlCommand cmd = new SqlCommand("put command here", con);
  3. DataTable dt = new DataTable();
  4. SqlDataAdapter da = new SqlDataAdapter(cmd);
  5.  
  6. da.Fill(dt);
  7. GridView.DataSource = dt;
  8. GridView.DataBind();
  9.  
Hope this helps
Aug 23 '10 #7
Frinavale
9,735 Recognized Expert Moderator Expert
Please review the following article that outline how to use a database:
Database tutorial Part 1
Database tutorial Part 2
Aug 25 '10 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

11
4620
by: lduperval | last post by:
Hi, I`m trying to do date calculations in three types of time zones: local, GMT and specified. The issue I am facing is that I need to be able to specify a date in the proper time zone, and I`m...
16
17374
by: Nikolay Petrov | last post by:
How can I return multiple values from a custom function? TIA
3
1887
by: Oliver Bleckmann | last post by:
hey, which ways are available i c++ to return multiple values i know u can use structs, any other methods? concrete question: i want to do sth. like this: returning two strings into stringvars...
1
2744
by: v4u2chat | last post by:
Do I need to extend any of classes from AXIS to return multiple values? I'm exposing the following method as web service through AXIS to return multiple values. public ContactAddress...
10
13036
by: shankhar | last post by:
Hi all, In my project there is a requirement. If a user logged in at a time since he/she logged out others are not allowed to loggin using the same user name. That is to avoid multiple logins...
1
2373
by: ashokbio | last post by:
How to return multiple values by passing multiple arguments in function or subroutine using VB6? T. Ashok Kumar
4
2282
by: arnaudk | last post by:
I am trying to come up with a class design to deal with asynchronous data to be stored and analyzed over multiple time frames and could really use some design input. This is a rather long question...
1
6562
by: sreenu123 | last post by:
How to insert multiple records into a database table that are entered into a datagridview. With a single shot of Save all the records in the datagridview should be updated using C# . Can any one help...
1
1547
by: aritra2008 | last post by:
Hi, Can anybody tell me how can I insert multiple data in a data table of a database using DataGridView control in VB/ASP.Net? It is very urgent for me to know. Kindly anybody help me...
1
16925
by: progvar | last post by:
Hi i want to update data in database using datagridview actually i am displaying the data in datagridview and after that i want to update some rows data directly modifying the displayed data into...
0
7205
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7093
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
7006
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7467
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5592
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4685
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3166
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
744
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
397
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.