Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm Data Binding / June 2005

Tip: Looking for answers? Try searching our database.

Code for filling datagrid rows one by one

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
mf_sina - 12 Jun 2005 10:28 GMT
hi!
for many times i needed a code for datagrid to show a progressbar while
reading data from a database (*.mdb).
now i think if my form reads data from database one by one and then puts
them in datagrid row by row will solve this idea.
because progressbar min is 0 and the max is set to count of records in the
table in my database.
then as the program is reading records and adds them to datagrid, one unit
is added to progressbar until becomed quite full.
now what i need is a code for reading records from tblcustomers in databse
and putting them in datagrid1 row by row.

Database: database1.mdb
Table: TblCustomers
the table has 4 fields: ID,cust_name,Cust_city,Cust_State
form: frmCustomers
datagrid: datagrid1

i welcime any codes or samples
Bset wishes
Kourosh - 13 Jun 2005 20:34 GMT
> hi!
> for many times i needed a code for datagrid to show a progressbar while
[quoted text clipped - 16 lines]
> i welcime any codes or samples
> Bset wishes

check fill method, you can find your answer.
DCraig - 14 Jun 2005 23:52 GMT
Here's an example that might help - the other poster suggested using the
fill method but you asked for a row by row method so you can update your
progress bar.
Note: cn is a sql connection, rdr is an sql datareader, idxLanguagCode and
languageName are integers that retrieve the data by position in the results
coming back from SQL Server.  tblLanguages is a datatable, the sql select
statement was used to instantiate the command.

'Open connection, execute the reader,
'then loop through the result set and
'count the found values setting i.
cn.Open()
rdr = cmd.ExecuteReader()
While rdr.Read
   rw = Me.tblLanguages.NewRow()
   rw("language_code") = rdr.GetString(idxLanguageCode)
   rw("language_name") = rdr.GetString(idxLanguageName)
   tblLanguages.Rows.Add(rw)
i += 1
End While

hth;

DCraig.

> hi!
> for many times i needed a code for datagrid to show a progressbar while
[quoted text clipped - 16 lines]
> i welcime any codes or samples
> Bset wishes

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.