Regarding DALC Creation using stored procedures

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kanimozhiz
    New Member
    • May 2008
    • 11

    #1

    Regarding DALC Creation using stored procedures

    Hi
    I have created the DAL component using stored procedures but I am unable to insert,update and delete the records in the Database.

    But retrieve is done as a whole and unable to retrieve a particular record using the Id.
  • Delerna
    Recognized Expert Top Contributor
    • Jan 2008
    • 1134

    #2
    Originally posted by kanimozhiz
    Hi
    I have created the DAL component using stored procedures but I am unable to insert,update and delete the records in the Database.

    But retrieve is done as a whole and unable to retrieve a particular record using the Id.
    Sorry but this is too generic.
    Some code and a better description of the problem you are having would be helpful.

    Comment

    • kanimozhiz
      New Member
      • May 2008
      • 11

      #3
      Originally posted by Delerna
      Sorry but this is too generic.
      Some code and a better description of the problem you are having would be helpful.

      I am using the front end as VS .net2005, the language is C#
      the back end is SQL server2005.

      I have created the Stored procedures in sql and I want to access those SPs through DAL component.
      For that I have added the dataset in C# website project, in that I have added the table from DB and connecting the DB by configuring the methods in the TableAdapter.

      I am able to retrieve the data from the table but unable to insert,update or delete the data from the table using the option "Use existing stored procedure" while configure the methods in the TableAdapter.

      Then I am adding one class file. class1.cs in that I wrote the code that is given below...
      using System;
      using System.Data;
      using System.Configur ation;
      using System.Collecti ons.Specialized ;
      using System.Web;
      using System.Web.Secu rity;
      using System.Web.UI;
      using System.Web.UI.W ebControls;
      using System.Web.UI.W ebControls.WebP arts;
      using System.Web.UI.H tmlControls;
      public class student
      {
      public student()
      {

      StudentTableAda pters.studentTa bleAdapter stu = new StudentTableAda pters.studentTa bleAdapter();
      Student.student DataTable s1;
      s1 = stu.InsertQuery ();


      }
      }

      but when I right click on the insert method in the table adapter->preview data
      I got an error as "Object reference not set to an instance of an object" for that purpose only I am adding the above code to instantiate the object.

      but still I am getting the error like this "Cannot implicitly convert type 'object' to 'Student.studen tDataTable'. An explicit conversion exists (are you missing a cast?)"

      plz help as soon as possible. Its very urgent....
      Thanks in advance

      Regards,
      kani.Z

      Comment

      • ck9663
        Recognized Expert Specialist
        • Jun 2007
        • 2878

        #4
        Have you tried posting this on the C# forum? They might be able to help your better as this is more of C# question that an sql-server question.

        -- CK

        Comment

        Working...