Return Dataset to Business Layer & SHOW in datagrid in Presentation Layer

Posted by Hosseingholi under C# on 2/20/2010 | Views : 2781 | Status : [Member] | Replies : 5
hi
how i can return dataset to datagriedview
My business layer is memberBL Class
My Data Access Layer Is memberDA Class
My view Dataset Code in memberDL Class is:
        public DataSet View(memberBL member)
{
DataSet ds = null;

try
{
OpenCnn();

String selectStr = "select * from " + thisTable + "'";

OleDbDataAdapter da =new OleDbDataAdapter(selectStr, cnn);

ds = new DataSet();

da.Fill(ds, thisTable);

CloseCnn();
}
catch (Exception e)
{
String Str = e.Message;
}

return ds;
}

How I Can return Dataset in GriedView in Form?
hoW i can use in ds IN windows FORM?




Responses

Posted by: Abhi2434 on: 2/20/2010 [Member] [Microsoft_MVP] [MVP] Silver

Up
0
Down
Just Add reference to this Class Library Project to your Windows Form project.

Create an Object of the class, And call it.

DataSet ds = obj.view(memberBlobj);

Now if you have placed a Datagrid in the form, just call

dgrid.DataSource = ds;

Thats all you need.
Cheers.


www.abhisheksur.com

Hosseingholi, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Hosseingholi on: 2/20/2010 [Member] Starter

Up
0
Down
If The class name of Business layer is memberBL
& data access layer is memberDA
HOW to refrence
please coding them
please....

Hosseingholi, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vuyiswamb on: 2/22/2010 [Member] [MVP] [Administrator] NotApplicable

Up
0
Down
Good Day Hosseingholi

i have an article that i wrote about this

http://www.codeproject.com/KB/vb/N-Tier_Application_VB.aspx

Thank you for posting at Dotnetfunda

Vuyiswa Maseko



Thank you for posting at Dotnetfunda
[Administrator]

Hosseingholi, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Abhi2434 on: 2/22/2010 [Member] [Microsoft_MVP] [MVP] Silver

Up
0
Down
Well, to reference you need to add that DLL reference to the project. Open Solution explorer, and Right click on the References and add project reference.
memberBL mbl = new memberBL();
memberDA mda = new memberDA();

dgrid.DataSource = mda.view(mbl);


simple like this.

www.abhisheksur.com

Hosseingholi, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Nishithraj on: 2/24/2010 [Member] Bronze

Up
0
Down
Check

http://msdn.microsoft.com/en-us/library/aa581779.aspx

Mark this as answer, if it is.....

With regards
Nishithraj Narayanan

Hosseingholi, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response