Solved

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

Posted on 2003-11-14
10
832 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

 

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
 

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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

724 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