Solved

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

Posted on 2004-10-09
8
186 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
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 27

Expert Comment

by:Dabas
Comment Utility
Hi UnFiRe:
Maybe you should also provide a value for prjFinished?

Dabas
0
 
LVL 1

Author Comment

by:UnFiRe
Comment Utility
i have tried that - still the same error
0
 
LVL 10

Expert Comment

by:Hans Langer
Comment Utility
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
 
LVL 27

Accepted Solution

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

Dabas
0
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
LVL 4

Assisted Solution

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

Author Comment

by:UnFiRe
Comment Utility
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
Comment Utility
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
Comment Utility
Your Welcome.
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

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 …
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
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

12 Experts available now in Live!

Get 1:1 Help Now