Solved

Update source data from Dataset ***Urgent*** !

Posted on 2004-10-09
8
193 Views
Last Modified: 2010-04-24
I already have a dataset filled by few data adapters.
I am trying to add a record to a certain table's column and update the source database from dataset.
The source database is done in access (in case it might help)

dataset: ds
dataadapter: daPrj
table in dataset: prj
columns in table: prjNo(key, autonumber), prjName(string), prjFinished(yes/no)

When i try to update by using the following commands, a messagebox pops up saying "Parameter ?_1 has no default value"
I also tried to update by using this command but it does not actually update the database:
    daPrj.Update(ds)

 Private Sub mnuFilePrjNew_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuFilePrjNew.Click
        Dim myRow As DataRow = ds.prj.NewRow
        myRow(ds.prj.prjNameColumn) = "newly added project name"
        myRef.ds.prj.Rows.Add(myRow)
       
        Try
            daPrj.Update(ds, "prj")
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
End Sub


0
Comment
Question by:UnFiRe
[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
  • 2
  • 2
  • +1
8 Comments
 
LVL 27

Expert Comment

by:Dabas
ID: 12268305
Hi UnFiRe:
Maybe you should also provide a value for prjFinished?

Dabas
0
 
LVL 1

Author Comment

by:UnFiRe
ID: 12268328
i have tried that - still the same error
0
 
LVL 10

Expert Comment

by:Hans Langer
ID: 12268558
I think you must define the daPrj.UpdateCommand  property.
Look this article, maybe that help you,

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconupdatingdatabasewithdataadapterdataset.asp

Good Luck
0
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 
LVL 27

Accepted Solution

by:
Dabas earned 350 total points
ID: 12269584
UnFiRe:
Would you mind posting the Insert Command of the DataAdpater?

Dabas
0
 
LVL 4

Assisted Solution

by:eozz_2000
eozz_2000 earned 150 total points
ID: 12270438
Please put the sql of all commands.
0
 
LVL 1

Author Comment

by:UnFiRe
ID: 12271608
There is few more columns now. Thanks to you guys i have found something that was out of order - i gave the name of daPrj to another DA instead (late night programming). After i have gave right names to the adapters the msgbox does not popup anymore, however, the database does not get updated. It still has the same records after it should have gotten updated. Here are all the commands:

****** Update ****
UPDATE    prj
SET              prjDone = ?, prjEdited = ?, prjName = ?, prjTaken = ?, qSessions = ?
WHERE     (prjNo = ?) AND (prjDone = ?) AND (prjEdited = ?) AND (prjName = ?) AND (prjTaken = ?) AND (qSessions = ?) OR
                      (prjNo = ?) AND (prjDone IS NULL) AND (prjEdited IS NULL) AND (prjName IS NULL) AND (prjTaken IS NULL) AND (qSessions IS NULL) AND
                      (? IS NULL) OR
                      (prjNo = ?) AND (prjDone = ?) AND (prjEdited = ?) AND (prjName = ?) AND (prjTaken = ?) AND (qSessions IS NULL) AND (? IS NULL) OR
                      (prjNo = ?) AND (prjDone = ?) AND (prjEdited = ?) AND (prjName IS NULL) AND (prjTaken IS NULL) AND (qSessions IS NULL) AND (? IS NULL) AND
                      (? IS NULL)

***** Insert *******
INSERT INTO prj
                      (prjDone, prjEdited, prjName, prjTaken, qSessions)
VALUES     (?, ?, ?, ?, ?)

***** Delete *****
DELETE FROM prj
WHERE     (prjNo = ?) AND (prjDone = ?) AND (prjEdited = ?) AND (prjName = ? OR
                      ? IS NULL AND prjName IS NULL) AND (prjTaken = ?) AND (qSessions = ? OR
                      ? IS NULL AND qSessions IS NULL)
0
 
LVL 1

Author Comment

by:UnFiRe
ID: 12271629
Ok, Never mind now folks - i forgot to uncomment the Add statement. You helped me with your great hints. Thanks a lot!
0
 
LVL 10

Expert Comment

by:Hans Langer
ID: 12272646
Your Welcome.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

622 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