Solved

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

Posted on 2004-10-09
8
191 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Revamp Your Training Process

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

Question has a verified solution.

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

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

734 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