Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2004-10-09
8
Medium Priority
?
195 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 1400 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 600 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

730 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