?
Solved

parameter ?_3 has no default value;problems updating access 2000 database

Posted on 2004-04-15
12
Medium Priority
?
446 Views
Last Modified: 2008-03-10
parameter ?_3 has no default value

good day, i have a dataset with 5 datatables and 4 of them

write to 1 datatable

e.g.
Brand,Colour,Wheels,Rims,
write to CARSALE

in all of the above tables, the fields are of different

types of course, e.g. number, text, etc

i get the error:
parameter ?_3 has no default value

and i dont know where to start looking what the parameter is.


thank you



0
Comment
Question by:jxharding
  • 6
  • 6
12 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 10833920
Are you using the OleDbDataAdapter?

Bob
0
 

Author Comment

by:jxharding
ID: 10839944
Yes i am
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 10844187
Select the data adapter, and view the properties in the Property Window.  Find the SelectCommand, and expand that set.  You will find a Parameter collection under the SelectCommand.

Bob
0
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 

Author Comment

by:jxharding
ID: 10858421
thanks thelearnedone
i went through all the dataadapters and could not fined one paramater in the collections
maybe thats my problem?
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 10858472
What does the SQL statement for the SelectCommand look like?

Bob
0
 

Author Comment

by:jxharding
ID: 10860095
i think i potentially found my problem
i have a table in my physical database called payment
which contains a
autoincrement field called PAYMENTID
a beneficiaryID Field (int)
and invoiceNR (string)

now i dragged this table into my dataset1.xsd
but there are other tables as well,
i did not make any relationships, although there are.
what i need to do is:

add a new entry to payment table
e.g. if last paymentID of PAYMENTTABLE was 1, the next would be 2
and then the beneficiaryID and invoiceNR would be filled in as well.
e.g.

PAYMENTID,BENEFICIARYID,INVOICENR
2         19            ABC123

this is how i attempted it:
dim addPayment as dataset1.paymentrow = dsBeneficiary.Payment.NewPaymentRow

addpayment.benefeciaryID = 19
addpayment.invoicenr = "ABC123"


daPayment.update(dsbeneficiary,"Payment")
dsbeneficiary.payment.addpaymentrow(addpayment)
dsbeneficiary.acceptchanges

and now it runs through the hole code,no problem
but when i got to the database itself, nothing was written

daPayment SQL:
SELECT BeneficiaryID,InvoiceNR FROM PAYMENT
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 10860984
Try:

dsbeneficiary.payment.addpaymentrow(addpayment)

dsbeneficiary.acceptchanges

daPayment.update(dsbeneficiary,"Payment")

0
 

Author Comment

by:jxharding
ID: 10866235
thanks bob, it works!
is there any chance of u giving me a little explanation on the three lines, e.g.
line 1 has to be run before line 2 because of ...

thanks!
0
 

Author Comment

by:jxharding
ID: 10867525
the problem i have here is that i only know now how to copy

the examples and then from there i will use it as templates

in my program . i dont know why the following 3 lines work:


dsbeneficiary.payment.addpaymentrow(addpayment)
dapayment.update(dsbeneficiary,"Payment")
dsbeneficiary.acceptchanges

but these 3 lines DONT work:
dsbeneficiary.payment.addpaymentrow(addpayment)
dsbeneficiary.acceptchanges
dapayment.update(dsbeneficiary,"Payment")
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 10873060
I don't usually do business this way, so I have to think through this:

(1) AddRow adds a new row.
(2) AcceptChanges for the dataset calls the AcceptChanges for all rows states that are not Unchanged.
(3) Update writes the changes back to the database from the disconnected dataset

I don't think that you even need the AcceptChanges for this to work--it might even explain why it doesn't work, since you mark the row as not changed, and then try to update the database.

Bob
0
 

Author Comment

by:jxharding
ID: 10875481
thanks bob
when you mean you dont do business this way, what do you think im doing wrong?
since this is my 1st big vb.net app, id like to get it all right at the roots because i will obviously refer to following projects from this current one
0
 
LVL 96

Accepted Solution

by:
Bob Learned earned 2000 total points
ID: 10880064
I do something like this:

               Dim newRow As dataReferences.HintsRow = dataReferences.Hints.NewHintsRow

               newRow.Title = .textTitle.Text
               newRow.Hints = .textHints.Text

               ' Add a new row to the table.
               Me.dataReferences.Hints.AddHintsRow(newRow)

               ' Update the database with the added record.
               Me.adapterHints.Update(Me.dataReferences.GetChanges(DataRowState.Added))

Bob
0

Featured Post

Fill in the form and get your FREE NFR key NOW!

Veeam is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

Question has a verified solution.

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

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
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…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses
Course of the Month15 days, 18 hours left to enroll

850 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