I have created a datagridview on a vb.nt form with drug_id,brand_name,date_made,date_expired as columns and i want to get a vb.net procedure or vb.net code that will insert the data on the datagridview to my Access database when i click insert button on the form.My database contains int_id column which is autoincremental and my datagridview contains several rows.Thanks for anticipated help.

Hope this gets you started, it creates the insert query "q". You will need a connection and a command object.... You should read up on Datasets - Datatables - Datagridview - MS ACCESS. There are much easier ways of doing what you want. Please show what you have tried.

For r = 0 To DataGridView1.Rows.Count - 1
    q = "insert into data values('" & DataGridView1.Rows.Cells(0).Value & " ', ' " & DataGridView1.Rows.Cells(1).Value & "')"
Next

how can I insert data from a textbox viewed to datagridview and save to database in vb.net?

vanbane27 you need to start a new thread. I will also say that you need to provide a little more info about what you are trying to accomplish and show what you have tried.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.