ODBC DataAdapter error when automaticaly generating UPDATE and DELETE command for Access database

Why can't ODBC data adapter automaticaly generate UPDATE and DELETE commands for Access database? The error message (warning) is "Could not determine which columns uniquely identify the rows for "MyTable".".

I defined the primary key column in my Access database like this:

Primary Key: Yes
Data Type: AutoNumber
New Values: Increment
Format: (blank)
Caption: (blank)
Indexed: Yes (No Duplicates)

How can I define these commands myself? Could anyone clarify to me the usage of parameters with commands?
MilosAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

DaniProCommented:
I think the it's a bug of the ODBC driver ... try to use the OLE DB connection.
(In the Provider OLE DB list you must select the Microsoft Jet 4.0 OLE DB Provider)
0
MilosAuthor Commented:
That helped. It works.

I'll ask you one more question before I accept (which I will) your answer and I'll give you 300 points if you help me again. I hope it's not hard.

I have two forms, main and, for example, options form. I need to open options form from main form and use a value from main form in the options form. How do I send/get some value from one form to another?
0
DaniProCommented:
There's more solutions ...  here one:

Option wOption = new Option();
if (wOption.ShowDialog() == DialogResult.OK)
{
      string      value = wOption.paramValue;
}


i.e.: paramValue must have public or internal modifiers
0
OWASP Proactive Controls

Learn the most important control and control categories that every architect and developer should include in their projects.

MilosAuthor Commented:
I didn't understand a word now. What is Option? Why dialog? (sorry for my lack of knowledge)

Here's what I do:

private void menuItem_Click(object sender, System.EventArgs e)
{
      new Opcije().Show();
}

This is a procedure in Main form. "Opcije" iz a Windows Form. How can I send a value to Opcije, or even better, how can I change the property of, for example, text box in form Opcije in this procedure.
0
DaniProCommented:
Option is the name of your form ...

If you want pass a parameter to the window you must create a constructor in your form that access parameter and pass it:

// ..in MainForm
string      parmValue = "hello";
Opcije wOption = new Opcije(parmValue);
if (wOption.ShowDialog() == DialogResult.OK)
{
// here i get the return value
     string     value = wOption.paramValue;
}

// ..in parm Form
public Opcije(string myParm)
{
      InitializeComponent();

      // ... use myParm
}

I use ShowDialog for open the form in dialog mode that is better for a param window but you can also use .Show().
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
MilosAuthor Commented:
Thank you.
0
KBannerCommented:
Can I ask. A very quick question over this.

Using Ole Db dataAdapter, can I set it up to a table without a primary key. Have been stuck for ages on this. I'd be most grateful for a guiding anwser!! I cannot use a primary key in the software design.

Thanks in advance
Stuart
0
gmanglerCommented:
I have been trying for several hours with this same problem.

The answer says

'I think the it's a bug of the ODBC driver ... try to use the OLE DB connection.
(In the Provider OLE DB list you must select the Microsoft Jet 4.0 OLE DB Provider) '

However I see no Jet OLE DB provider. How do I install it

The driver I have is 4.00.6205.00 - ODBCJT32.DLL  - 3/25/2003
and it is for Access. Not Jet

I cannot get it to write UPDATE or DELETE statements for me.
0
KBannerCommented:
Hi gmangler,

Am having the same problem with creating UPDATE and DELETE using any DataAdapter whether ODBC or OLE DB. It's because I don't have a primary key in my underlying table.
I think you have a primary key don't you??

As for Ole Db. Have you tried to create a Ole Db DataAdapter and Connection.

Might me teaching Grandy to suck eggs, but here goes.

Ole Db should be installed with vb.net

1.Try making a Ole Db Connection.
2. In View, click Toolbox, and then click the Data Tab.
3. You should see Ole DB Connection in there along with various other Connections and Adapters.
4. Drag onto form
5. Click connection String property for the Ole Db connection control, and chose New Connection
6. Should open up a dialog form. Click the 'Provider' Tab and in their should see 'Microsoft Jet 4.0 OLE DB Provider'
7. You can then set up your OleDb DataAdapter using this connection.

Can you do us a favour, can you just confirm that your error is due an error in ODBC DataAdapter rather than not having a primary key set in your underlying Table???

Stuart
0
gsilveyCommented:
I had the same problem (wizard could not create UPDATE or DELETE) and switched from ODBC connection to OLEDB Connection. The wizard now works.

However, now I am having problems with the VB.NET program that uses the db. I have checkboxes on my form that used to be automatically updated as I scrolled through a combo box. I've checked the properties of the checkboxes (Data Bindings / Checked) and they look fine to me. Do I need to do something different now that it is ole instead of odbc?

Thanks,
    Garry
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.