Insert Textbox values to database

Posted on 2006-04-24
Last Modified: 2010-05-01
Hi Experts,

I need to collect the value of textboxes on a form and send those values to a database using a button click (SaveAddOffenses).  I have the following code so far:

    Private Sub SaveAddOffenses_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SaveAddOffenses.Click
        Dim MyConnection As SqlConnection = New SqlConnection()
        MyConnection.ConnectionString = _
        "Network Library=DBMSSOCN;" & _
        "Data Source=itadmin4,1433;" & _
        "Initial Catalog=Reporting;" & _
        "User ID=sa;" & _

        Dim mycommand As SqlCommand
        Dim dr As SqlDataReader
            mycommand = New SqlCommand("Select * from Incidents", MyConnection)
            dr = mycommand.ExecuteReader()
        Catch ex As Exception
        End Try

    End Sub
End Class

I know I am close but I cannot figure it out.  Thanx in advance.  

P.s.  I am using VB 2005 accessing sql 2005 database
Question by:NCSO
    1 Comment
    LVL 8

    Accepted Solution


    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
    If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
    Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
    Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now