It wont work

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hime
    New Member
    • Oct 2006
    • 13

    It wont work

    hello all

    I am using .Net C# & MySql i made a data entry form to fill the tables and it's working ok. my data entry form consists of textboxes through each one I will save the data to the tables. the problem began when I tried to display the info. in my tables using the textbox, I want to be able not just to enter data but also walk through my table using a next and prev. buttons . here is my code

    Code:
    private void next_Click(object sender, System.EventArgs e)
    		{
    			i+=1;
    						
    			if (i <= ds.Tables[0].Rows.Count)
    			{
    				
    	empid.Text = ds.Tables[0].Rows[i][0].ToString();		empnam.Text = ds.Tables[0].Rows[i][1].ToString();
    	empdesc.Text = ds.Tables[0].Rows[i][2].ToString();
    i+=1;
    }
    the table contains 10 records but the button only work for one click

    thank you all for your concern
    Last edited by hime; Jan 21 '07, 12:37 PM. Reason: update
  • kenobewan
    Recognized Expert Specialist
    • Dec 2006
    • 4871

    #2
    Basically you need to refill the dataset from the data adapter each time that you use it...

    Hope that this helps.

    Comment

    • kenobewan
      Recognized Expert Specialist
      • Dec 2006
      • 4871

      #3
      Actually first port of call is the variable i, the function will not increment the way it does in a loop as the value is not returned... Try declaring it as a global variable and returning it.

      Hope that this helps.

      Comment

      • seshu
        New Member
        • Nov 2006
        • 156

        #4
        hi this is seshu actually i never tried your doubt in c# but i can say u what i da in vb first i fille the dataset using this code
        in form class
        dim bm as bindingmanagerb ase

        in form_load
        dim da as odbc.odbcdataad apter
        dim ds as dataset
        da.fill(ds,"tab lename")
        textbox1.databi nd=ds(table(0). field(0))
        bm=me.bindingco ntext(ds,"table name")
        bm.position=0
        in button_click (this button is next button)
        bm.position+=1
        end sub

        Comment

        • seshu
          New Member
          • Nov 2006
          • 156

          #5
          if the above code does not work and if you say that i dont mine using wizzard i can give you that even

          Comment

          • hime
            New Member
            • Oct 2006
            • 13

            #6
            First of all thank u for ur reply,
            but I tried to use the suggestions you gave me but it didn't work I will keep trying and actually I don't mined using any thing that will work, but I am not sure if wizard works with mysql and also I feel like many things doesn't work smoothly with mysql or more likely its me

            thanks

            Comment

            Working...