Showing posts with label class. Show all posts
Showing posts with label class. Show all posts

Monday, March 26, 2012

EnterpriseLibrary 2006 DATA ACCESS LAYER

in the class library i written the code name :customer is the lib name

using System;

using System.Collections.Generic;

using System.Text;

namespace Customer

{ class Entites

{

public int inTest;

public int inTest2;

}

}

Now in the Class1.cs i written the code

i am getting the data from the database by using enterprise lib 2006 connection function

now HOW TO BIND THE DATA TO LIST AND RETURN TYPE IS LIST

PLEASE CHECK THE CODE AND REDEFINE THE CODE

using System;

using System.Data ;

using System.Collections.Generic;

using System.Collections.Generic;

using System.Text;

using Microsoft.Practices.EnterpriseLibrary.Data;

using Microsoft.Practices.EnterpriseLibrary.ExceptionHandling;

using Microsoft.Practices.EnterpriseLibrary.Common.Configuration;

using System.Collections;

using System.Xml.Serialization;

using System.Data.Common;

using Customer;

namespace Customer

{

class Class1

{

public List<Entites> getdata(int id)

{

Database db = DatabaseFactory.CreateDatabase("mycon");

System.Data.Common.DbCommand cmd ;

cmd = db.GetStoredProcCommand("GET_CUSTOMER");

cmd.CommandType = CommandType.StoredProcedure;

db.AddInParameter(cmd,"@.CID",System.Data.DbType.Int32,id);

List<Entites> objEntites = new List<Entites>();

using (IDataReader dr = db.ExecuteReader(cmd))

foreach (Entites obj in dr)

{

objEntites.inTest = obj.inTest;--ERROR LINE

// objEntites.Add(obj);

}

return objEntites;

}

}

}

Error 2 foreach statement cannot operate on variables of type 'System.Data.IDataReader' because 'System.Data.IDataReader' does not contain a public definition for 'GetEnumerator' D:\KOTI_PRJS\Enterprise\Customer\Class1.cs 34 13 Customer

Is this related to SSIS? If not, let me know and I'll be happy to move it to a more appropriate forum. If it is, please describe where the problem is occurring in SSIS.

Wednesday, February 15, 2012

Enterprise class not registered 6.5

Today morning i tried connecting to sql 6.5 through enterprise edition got the following error
SQL ole object could not be registered class not registered (80040154)
I did shut down and restart, stopped and restarted the servicesAs obvious this is a problem with the class or the associated OLE dll not being registered in the registry properly . You can use the regsvr32 utility to re-register it :-

regsvr32 (path)\binn\sqlole65.dll

And replace (path) with the full drive/directory that SQL Server is installed into.|||Thanks works very good

One more question

How best to display data on web without knowing any language|||I think its not possible to work if you don't know any language ( in terms of IT). Can you rephrase your question agian.|||I just know sql and html the basic

any one language i can use to represent data on web and easy too learn

like combination or reporting tools ( crystal report) and something else too|||Then no issues in representing the data on a web page.
ASP with SQL is best combination I've seen so far (as I'm concerned).

Refer to MSDN & Technet for SQL for further information.|||Representing data using sql and asp is enough

I mean will it allow the user to choose say dates if i represent it on a drop down menu ( can asp do it i mean)

In short will i be able to represents most of the data using ASP (JUST)

OFCOURSE BESIDE SQL IN PROCEDURE OR FUNCTION