How to update MS Access DB from a VB.Net Gridview Control

Asked By 0 points N/A Posted on -
qa-featured

I have a table designed in MS Access with the below fields:

DC No (Primary Key and Not Auto Generated – Integer

Item Description – Text

Reference Number – Text and

Quantity – Integer

My VB.NET form has a textbox field where the user would enter the DC Number. I have used the Grid Control to displays the fields (field number 2 to 4). My problem is, I do not know what piece of code should I have for my SAVE button's click event to write the data both from my Textbox and Grid rows to the MS Access database. I tried the basic Binding to Database as seen in the MSDN pages but it does not help. It keeps throwing me an error:

"Too few columns for the primary key"I could hardly understand what does this error mean and how is it related to my case. Any guidance, please?
 
SHARE
Answered By 0 points N/A #84605

How to update MS Access DB from a VB.Net Gridview Control

qa-featured
Hi,
 
For the table designing in Ms access regarding your fields you have to enter a code in which you have confused, firstly you must confirm that what should be the code you will enter will be best for this option. The code is for the purpose of to telling you it is connect to an access database. It also allow you to displaying of data and the new record you enter in it.
 
Also for editing of new record and for delete the wrong or old data. It must be sure that the code you have to use it must be connected in such a way like it must be informative and you may learn something from it. For the use of code setup the new form with particular objects. Then create MS access Database according to your table.
 
After it the code like this enter in the form:
 
Imports System.Data.OleDb
You can get some instructions from web by the following address
 

Login/Register to Answer

Related Questions