Click here to Skip to main content
15,892,161 members

Error in update & Delete

kanha.460 asked:

Open original thread
Hello freinds,
I am using a dataset page dataset.xsd. In it i am having a table named asp3, Whenever i am trying to insert the data in the table through DataSet1TableAdapters.asp31TableAdapter class, data is inserted but if i am trying to update or delete the data it is giving an error. My code is :

C#
 protected void insrt_btn_Click(object sender, EventArgs e)
        {
            int emp_id = int.Parse(id_txtbx.Text);
            int sal = int.Parse(sal_txtbx.Text);
            DataSet1TableAdapters.asp31TableAdapter da3 = new DataSet1TableAdapters.asp31TableAdapter();
            da3.Insert(emp_id, name_txtbx.Text, sal);
            GridView2.DataSource = da3.GetData();
            GridView2.DataBind();
        }

        protected void updt_btn_Click(object sender, EventArgs e)
        {
            int emp_id = int.Parse(id_txtbx.Text);
            int sal = int.Parse(sal_txtbx.Text);
            DataSet1TableAdapters.asp31TableAdapter da3 = new DataSet1TableAdapters.asp31TableAdapter();
            da3.Update(emp_id, name_txtbx.Text, sal);
            GridView2.DataSource = da3.GetData();
            GridView2.DataBind();
        }

        protected void dlt_btn_Click(object sender, EventArgs e)
        {
            int emp_id = int.Parse(id_txtbx.Text);
            int sal = int.Parse(sal_txtbx.Text);
            DataSet1TableAdapters.asp31TableAdapter da3 = new DataSet1TableAdapters.asp31TableAdapter();
            da3.Delete(emp_id);
            GridView2.DataSource = da3.GetData();
            GridView2.DataBind();
        }
    }
}


The bold lines are giving error.
HTML
Error	2	'DAL_BLL.DataSet1TableAdapters.asp31TableAdapter' does not contain a definition for 'Delete' and no extension method 'Delete' accepting a first argument of type 'DAL_BLL.DataSet1TableAdapters.asp31TableAdapter' could be found (are you missing a using directive or an assembly reference?)	C:\Users\KANHA\Documents\Visual Studio 2010\Projects\DAL BLL\DAL BLL\WebForm1.aspx.cs	63	17	DAL BLL (dataset)



HTML
Error	1	No overload for method 'Update' takes 3 arguments	C:\Users\KANHA\Documents\Visual Studio 2010\Projects\DAL BLL\DAL BLL\WebForm1.aspx.cs	53	13	DAL BLL (dataset)



Thanx in advance

With regards,
Rakesh Sharma
Tags: ASP.NET, Database Development, Dataset

Plain Text
ASM
ASP
ASP.NET
BASIC
BAT
C#
C++
COBOL
CoffeeScript
CSS
Dart
dbase
F#
FORTRAN
HTML
Java
Javascript
Kotlin
Lua
MIDL
MSIL
ObjectiveC
Pascal
PERL
PHP
PowerShell
Python
Razor
Ruby
Scala
Shell
SLN
SQL
Swift
T4
Terminal
TypeScript
VB
VBScript
XML
YAML

Preview



When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
  4. Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the http://www.codeproject.com/info/cpol10.aspx.



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900