Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Problem using dataset in vb.net

Problem using dataset in vb.net

Scheduled Pinned Locked Moved Visual Basic
csharpdatabasehelp
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    ShuklaGirish
    wrote on last edited by
    #1

    I have created one project which is working fine,but there is one big problem,i.e. when we add, modify or delete records it gets properly updated in the dataset as well as in the dtabase.I close the project and check the database it sores data properly but when i re-execute the project data in the database gets lost(menas database tables becomes empty).Et could be the reason. GIRISH

    V D 2 Replies Last reply
    0
    • S ShuklaGirish

      I have created one project which is working fine,but there is one big problem,i.e. when we add, modify or delete records it gets properly updated in the dataset as well as in the dtabase.I close the project and check the database it sores data properly but when i re-execute the project data in the database gets lost(menas database tables becomes empty).Et could be the reason. GIRISH

      V Offline
      V Offline
      Vimalsoft Pty Ltd
      wrote on last edited by
      #2

      Stop Stop Stop Stop Stop you are Saying many things at the same time. we are trying to see the Problem and you jump to another. you need to solve the Problem Step by Step. Now lest start here.

      |ShuklaGirish: write

      when we add, modify or delete records it gets properly updated in the dataset

      How do you know this for sure, paste the code that confirm that it has added your record to the dataset.

      |ShuklaGirish: write
      I close the project and check the database it sores data properly but when i re-execute the project data in the database gets lost

      Lets see the code that you are using to save to the DB not DAtaset. and what DBMS you are using. Access or SQL? Thanks

      Vuyiswa Maseko, Sorrow is Better than Laughter, it may Sudden your Face, but It sharpens your Understanding VB.NET/SQL7/2000/2005 http://vuyiswamb.007ihost.com http://Ecadre.007ihost.com vuyiswam@tshwane.gov.za

      S 1 Reply Last reply
      0
      • V Vimalsoft Pty Ltd

        Stop Stop Stop Stop Stop you are Saying many things at the same time. we are trying to see the Problem and you jump to another. you need to solve the Problem Step by Step. Now lest start here.

        |ShuklaGirish: write

        when we add, modify or delete records it gets properly updated in the dataset

        How do you know this for sure, paste the code that confirm that it has added your record to the dataset.

        |ShuklaGirish: write
        I close the project and check the database it sores data properly but when i re-execute the project data in the database gets lost

        Lets see the code that you are using to save to the DB not DAtaset. and what DBMS you are using. Access or SQL? Thanks

        Vuyiswa Maseko, Sorrow is Better than Laughter, it may Sudden your Face, but It sharpens your Understanding VB.NET/SQL7/2000/2005 http://vuyiswamb.007ihost.com http://Ecadre.007ihost.com vuyiswam@tshwane.gov.za

        S Offline
        S Offline
        ShuklaGirish
        wrote on last edited by
        #3

        Hi, thnx for ut reply.I am using Ms-Access 2003. I am showing u the code, this is the code i am using to update the data, Dim res As Integer = executeDML("update schedule set [date]='" & txtdate.Text & "',[vehno]='" & ComboBox1.SelectedValue & "',[from]='" & txtfrom.Text & "',[from_time]='" & txtfromtime.Text & "',[to]='" & txtto.Text & "',[to_time]='" & txttotime.Text & "',[driver]='" & txtdriver.Text & "',[remarks]='" + txtremarks.Text & "' where [id]=" & scheduleid) If res > 0 Then MsgBox("Record Updated Successfully!!") Else MsgBox("Error while Updating Record!!") End If executedml is function defined in module which is, Public Function executeDML(ByVal command As String) As Integer Try com.CommandText = command com.Connection = con makeConnection() rs = com.ExecuteNonQuery() closeConnection() Return rs Catch ex As Exception If schedulecode = True Then MsgBox("This vehicle is already at booked at spcified time") Else MsgBox(ex.Message) End If End Try End Function i have degug the code also everything runs properly. So,wt could be the problem?

        1 Reply Last reply
        0
        • S ShuklaGirish

          I have created one project which is working fine,but there is one big problem,i.e. when we add, modify or delete records it gets properly updated in the dataset as well as in the dtabase.I close the project and check the database it sores data properly but when i re-execute the project data in the database gets lost(menas database tables becomes empty).Et could be the reason. GIRISH

          D Offline
          D Offline
          Dave Kreskowiak
          wrote on last edited by
          #4

          The Access database is part of your project. The file is also tagged as Copy Always when you build and execute your project. So, every time you hit F5 in the debugger, it copies the database from your project folder to the Debug folder your .EXE shows up in, overwriting the database your code is actually using.

          A guide to posting questions on CodeProject[^]
          Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
               2006, 2007

          S 1 Reply Last reply
          0
          • D Dave Kreskowiak

            The Access database is part of your project. The file is also tagged as Copy Always when you build and execute your project. So, every time you hit F5 in the debugger, it copies the database from your project folder to the Debug folder your .EXE shows up in, overwriting the database your code is actually using.

            A guide to posting questions on CodeProject[^]
            Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                 2006, 2007

            S Offline
            S Offline
            ShuklaGirish
            wrote on last edited by
            #5

            thank u very much, my problem gets solved. thanks alot. GIRISH

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups