Hi,

I've been working on a piece of code to get a GUI to input data into then save to an SQL server database but as ever I got stuck. I followed a tutorial for it but now I'm stuck with the wrong type of input (gridview). I tried different ways to get it so I could input into textboxes and save, however there were still always problems.

I've attached the code for the gridview GUI so you could see where I am with that:

Code:
Imports System.Data.SqlClient


Public Class Main
    Private connstr As New SqlConnection("ConnectionString")
    Private dadapter As New SqlDataAdapter("Select Name, Age, Address, PkID From tblPatients", connstr)
    Private dset As New DataSet
    Private cmdb As New SqlCommandBuilder(dadapter)

    Private Sub Main_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        dadapter.Fill(dset, "tblPatients")
        dgrid.DataSource = dset.Tables("tblPatients")

    End Sub

    Private Sub btnsave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnsave.Click

        dadapter.UpdateCommand = cmdb.GetUpdateCommand
        dadapter.Update(dset.Tables("tblPatients"))
        MsgBox("Record Saved")

    End Sub

End Class
Any help as to how to get it into textboxes then save to the database would be greatly appreciated, and if not then could you point me in the right direction?

Thank you!