Solved

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

Posted on 2003-11-14
10
814 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:Milos
Comment Utility
Thank you.
0
 

Expert Comment

by:KBanner
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Article by: Ivo
Anonymous Types in C# by Ivo Stoykov Anonymous Types are useful when  we do not need to follow usual work-flow -- creating object of some type, assign some read-only values and then doing something with them. Instead we can encapsulate this read…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

772 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

10 Experts available now in Live!

Get 1:1 Help Now