getting fresh data on the screen

  • Thread starter Thread starter Hyphessobricon
  • Start date Start date
H

Hyphessobricon

Hallo,

after inserting some new data , I don't succeed in seeing these immediately
on the srceen . Although the data are in the database, I don't get them on
the next form without closing the application first. What do I forget?

Dim dc As New OleDb.OleDbCommand("insert into tblAankoop values (" &
frmBekijken.lblJaartal.Text & "," & frmBekijken.txtAuto.Text & "," &
frmBekijken.txtAutoDat.Text & ")", cn)
Dim daAankoop As New OleDb.OleDbDataAdapter(dc)
Dim dsAankoop As New DataSet("tblAankoop")
Try
daAankoop.Fill(dsAankoop)
Catch ex As Exception
MsgBox(ex.Message)
End Try

Please help. I know it must be simple, but I cannot find it.

a thankful Hyphessobrycon
 
The command you are passing to your Data Adapter's constructor isn't a
"Select" command - which is what it assumes it to be here. Change that
commadn to your adapter's INsert command (Although you'll need to do a few
things to get it to work - I'd highly recommend paramaterizing the query
as well - dynamic SQL without params is nothing but headaches. Now, use a
different commadn with SELECT blah from whatever table. Call Update first -
that will sumbit your changes - then you can just call fill again which
will repopulate everything.

One point though - IF your database supports batched commands - you can
apped a select statement on the Insert command and it should refresh itself
..
 
Hyphessobrycon

You mixing up everything.

What you can try to learn is using a data form wizard (and than use it never
more, because it is bad maintanancing using that).

(Open all + in the code for that to show what is made)

It can give you idea's how you can make a dataform.

I hope this helps something

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top