Zdravim. Poradi niekto ? Pridavam do tabulky "CisOdbory" v MS SQL Server 2005 Express riadok...udaje typujem do txtBoxov na forme a tabulku zobrazujem na tom istom forme v DataGridView1...nefunguje mi to, poradi niekto kde robim chybu?
Private Sub frmCisOdb_Load......
conn.ConnectionString = "server=MojServ;database=Cvicna;User Id=nejakyuziv;pwd=nejakeheslo"
daCisOdbory.SelectCommand = New SqlClient.SqlCommand("SELECT * FROM CisOdbory", conn)
daCisOdbory.Fill(ds, "CisOdbory")
mCisOdbory = ds.Tables("CisOdbory")
.
Dim cb As New SqlClient.SqlCommandBuilder(daCisOdbory)
daCisOdbory.InsertCommand = cb.GetInsertCommand
.
txtCOdbor.DataBindings.Add("Text", mCisOdbory, "COdbor")
txtNazov.DataBindings.Add("Text", mCisOdbory, "Nazov")
txtSkratkaodb.DataBindings.Add("Text", mCisOdbory, "Skratkaodb")
Me.DataGridView1.DataSource = mCisOdbory
.
.
Sub btnNovy_Click....
Dim dr As DataRow = ds.Tables("CisOdbory").NewRow()
ds.Tables("CisOdbory").Rows.Add(dr)
daCisOdbory.InsertCommand = cb.GetInsertCommand
daCisOdbory.Update(ds.GetChanges, "CisOdbory")
Me.DataGridView1.DataSource = mCisOdbory
Me.DataGridView1.Refresh()
Me.DataGridView1.Focus()
zaciatocnik
|