Results 1 to 3 of 3
  1. #1

    Default C# Programming : DataSet/DatTable and SQL/OLEDB Data Adapter


    Mga bro and sis, unsay nindot nga paagi nga while nag fill ang dataset nako...i display sad siya at the same time sa data grid view and if possible naay progress bar and i display ang progress percentage.

    naa koy sample program..ako i list ang mga items sa DGV pero kani akong gibuhat, mag w8 pa siya nga mahuman tanan ug fill sa Datatable before i display sa DGV. So if daghan kaayong record, pwerting hinaya.



    //Mao ni akong code para ma fill ang datatable:

    Code:
    DataTable itemList = new DataTable("ItemList");
            private void itemLoad()
            {
         string cmdTxt = 
    "SELECT Barcode_Number, Item_Name, Selling_Price " +
                    "FROM Item_List " +
                    "ORDER BY Item_Name";
                OleDbConnection conn = new OleDbConnection(serverConnStr);
                OleDbCommand cmd = new OleDbCommand(cmdTxt,conn);
    
                conn.Open();
                OleDbDataAdapter da = new OleDbDataAdapter(cmd);
                da.Fill(itemList);
    
                cmd.Dispose();
                da.Dispose();
                conn.Close();
            
            }
    
    //and para ma display nako sa DGV...
            private void displayItems()
            {
                int itemCount = itemList.Rows.Count;
                double progress = 0;
                progressBar.value = 0;
                dgv_ItemList.Rows.Clear();
                for (int i = 0; 1 < itemCount; i++)
                {
                    dgv_ItemList.Rows.Add(
                        Convert.ToInt64 (itemList.Rows[i].ItemArray[0]), //Barcode_Number
                        itemList.Rows[i].ItemArray[1].ToString(),        //Item_Name
                        Convert.ToDouble (itemList.Rows[i].ItemArray[2]) //Item_Price
                        );
                    progress += ((1 /Convert.ToDouble(itemCount)) * 100);
                    progressBar.value = Convert.ToInt32 (progress);
                
    }
     //Button SUBMIT
            private void btn_Submit_Click(object sender, EventArgs e)
            {
    itemLoad();
    displayItems();
            }
    
    


    This is not a school project or assignment. nag study ra ko sa about C# Progamming so please pa help ko about ni mga bro/sis.

    thanks!
    Last edited by ajboy13; 07-18-2012 at 12:28 PM.

  2. #2

    Default Re: C# Programming : DataSet/DatTable and SQL/OLEDB Data Adapter

    use DataReader instead of DataTable no additional overhead and should be faster. If you have millions of records, do not pull all the records from db, have them paged and pull the page one at a time as needed.

  3. #3

    Default Re: C# Programming : DataSet/DatTable and SQL/OLEDB Data Adapter

    I have tried asp.net (VB).

    Using SQL stored procedures also helps faster querying from the database.


    As suggested by 0m1cr0n, have them paged.

    Pwede pud for Item Name, maghimo ka link for items that start with A, B, C, D, E... items...When a user clicks A, you only get items that starts with A haron dili tanan items kuhaon sa database kay sure nga bug-at labi na ug minilyon nga records.

  4.    Advertisement

Similar Threads

 
  1. Want To Buy: Do you have PHP and SQL books?
    By idontknow19 in forum Books & Magazines
    Replies: 1
    Last Post: 10-13-2011, 04:35 AM
  2. For Rent: Lease to Purchase Program for (Collinwood and Brookfield Subdivision)
    By K|SsSeR_m in forum Real Estate
    Replies: 73
    Last Post: 07-29-2011, 10:59 AM
  3. For Sale: LG and Samsung USB Data Cable
    By mark_labus in forum Cellphones & Accessories
    Replies: 1
    Last Post: 10-12-2009, 06:59 PM
  4. HELP VB6 and SQL how to's
    By The_Undertaker in forum Programming
    Replies: 15
    Last Post: 08-30-2008, 09:55 AM
  5. Codes on how to import sql server data to excel
    By Deadstring67 in forum Programming
    Replies: 5
    Last Post: 03-12-2007, 10:28 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
about us
We are the first Cebu Online Media.

iSTORYA.NET is Cebu's Biggest, Southern Philippines' Most Active, and the Philippines' Strongest Online Community!
follow us
#top