By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,364 Members | 1,341 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,364 IT Pros & Developers. It's quick & easy.

Regarding DALC Creation using stored procedures

P: 11
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.
May 21 '08 #1
Share this Question
Share on Google+
3 Replies


Delerna
Expert 100+
P: 1,134
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.
May 21 '08 #2

P: 11
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.Configuration;
using System.Collections.Specialized;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public class student
{
public student()
{

StudentTableAdapters.studentTableAdapter stu = new StudentTableAdapters.studentTableAdapter();
Student.studentDataTable 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.studentDataTable'. An explicit conversion exists (are you missing a cast?)"

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

Regards,
kani.Z
May 21 '08 #3

ck9663
Expert 2.5K+
P: 2,878
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
May 21 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.