locked
I can't add information to the database and the forms dont close RRS feed

  • Question

  • Good afternoon, if anyone can help i would be very glad, i'm doing a software in the visual studio 2012 and i'm not able to add new information to the original database, only to the one created in the  BIN, and on top of that my primary key is not being created automatically, as i program it to be in the database, because when i try to run the codind to add a new information, it says the the first textbox is going to be sent to the pk, and i cant solve it. Here is the code that i used:

        Private Sub add_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles add.Click
            EXAME.ExameTableAdapter.Insert(Me.TextBox2.Text, Me.TextBox3.Text, Me.TextBox4.Text, Me.TextBox5.Text)
            EXAME.ExameTableAdapter.Fill(EXAME.PROGRAMA_HOSPITAL_SAO_JUDAS_TADEUDataSet.Exame
                                         )

    Error 1 Argument not specified for parameter 'Observação' of 'Public Overridable Overloads Function Insert(Codexame As String, Descrição As String, Laudo As String, Valor As String, Observação As String) As Integer'. C:\Users\Guilherme\Documents\Visual Studio 2012\Projects\programa hospital\programa hospital\novoexame.vb 10 9 programa hospital

    And there is another problem that when i try to open a new form, i put a code saying me.hide, so that you can return to the previous form when you click in it, but when you close one form, the others are still hiding so the program doesnt stop running, should i change the code?



    Wednesday, March 14, 2018 9:43 PM

All replies

  • When using this forum, please try to keep to one question per thread.  Otherwise it can become very messy and confusing trying to deal with multiple separate problems in one thread.

    You have three problems:

    1) Updating the wrong copy of a database

    2) Inserting records into database

    3) Ending a program with hidden forms

    Please edit this post to address one of the problems, then create two more threads for each of the other two problems.  I suspect most of these are beginner errors and will be easily addressed with the exception of #2 which will require more information about your database and dataset configurations (its probably still easily addressed, we will just require more detail to help).


    Reed Kimble - "When you do things right, people won't be sure you've done anything at all"


    Wednesday, March 14, 2018 9:50 PM
    Moderator
  • Ok, i'll do that, thanks a lot, and i'm sorry for asking way to many things in the same post
    Wednesday, March 14, 2018 9:57 PM
  • Ok, i'll do that, thanks a lot, and i'm sorry for asking way to many things in the same post

    That's ok, thank you for your cooperation. :)

    As another tip since you are new here, when the issue in one of your threads has been solved, you close the thread by clicking the Mark as answer link at the bottom of any post or posts which directly solved the problem.  Other posts that were useful can be marked with the Vote button.

    I'll lock this thread for a day or two to give you a chance to see this reply, and then delete the thread.


    Reed Kimble - "When you do things right, people won't be sure you've done anything at all"

    Thursday, March 15, 2018 1:46 AM
    Moderator