I want to search person by auto increment ID (textbox and one button). I have used dataset and in that
Fill,Getdata --> configure
SQL statement :
SELECT ID, FirstName, LastName, ContactNo, Address, Date, NameOfJob, OtherJob,
Impression, BackPage, NameOfPage, PaperSize, PrintingSize,
DesignRupees, JobRupees, Matter, BlackPlate, BlackPlateRupees, SinglePlate,
SinglePlateRupees, MultiPlate, MultiPlateRupees, Platename,
Lamination, Creasing, Binding, Other, Total, Receive, Due, LastRemaining
FROM bill WHERE ID=@ID
after that I have run the program then 2 error shows:
- cannot convert from string to decimal
-
The best overloaded method match for
WindowsFormsApplication9.DataSet1TableAdapters.billTableAdapter.Fill(WindowsFormsApplication9.DataSet1.billDataTable, decimal) has some invalid argumentserror in this linethis.billTableAdapter.Fill(this.DataSet1.bill, txt_search.Text);
So your errors are:
cannot convert from string to decimaland
WindowsFormsApplication9.DataSet1TableAdapters.billTableAdapter.Fill(WindowsFormsApplication9.DataSet1.billDataTable, decimal);if you look at what you are trying to put into the
Fill()method:this.billTableAdapter.Fill(this.DataSet1.bill, txt_search.Text);What your errors are telling you is that it can’t convert a string into a decimal. Your fill method is requiring a decimal as it’s second parameter, but you are providing it a string (
txt_search.Text).You need to Convert/Parse the string into a decimal first, then call your
.Fill()method with this value.Have a look into
decimal.Parse()anddecimal.TryParse().