Solved

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

Posted on 2003-11-14
10
823 Views
Last Modified: 2010-08-05
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?
0
Comment
Question by:Milos
  • 3
  • 3
  • 2
  • +2
10 Comments
 
LVL 6

Expert Comment

by:DaniPro
ID: 9747160
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
 

Author Comment

by:Milos
ID: 9747385
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
 
LVL 6

Expert Comment

by:DaniPro
ID: 9747499
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
 

Author Comment

by:Milos
ID: 9747729
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
 
LVL 6

Accepted Solution

by:
DaniPro earned 300 total points
ID: 9747867
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:Milos
ID: 9747900
Thank you.
0
 

Expert Comment

by:KBanner
ID: 10083036
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
 

Expert Comment

by:gmangler
ID: 10099445
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
 

Expert Comment

by:KBanner
ID: 10103216
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
 

Expert Comment

by:gsilvey
ID: 10155633
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

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now