Look next examples
- Code: Select all
Employees emp = new Employees();
//Example 1 -> Complete connection string
emp.ConnectionString = \"server=nameServer;database=Northwind;Integrated Security=true\";
//Example 2 -> With integrated security
emp.ConnectionServer = \"nameServer\";
emp.ConnectionDatabase = \"Northwind\";
emp.UseIntegratedSecurity = true;
//Example 3 -> Without integrated security
emp.ConnectionServer = \"HYP3834\";
emp.ConnectionDatabase = \"Northwind\";
emp.UseIntegratedSecurity = false;
emp.ConnectionUserID = \"sa\";
emp.ConnectionPassword = \"passwordsa\";
emp.ProviderFactoryDb = System.Data.SqlClient.SqlClientFactory.Instance;
The EntityObject need a DbProviderFactory, you can use next options:
- Code: Select all
System.Data.Odbc.OdbcFactory //ODBC
System.Data.OleDb.OleDbFactory //OleDB
System.Data.OracleClient.OracleClientFactory //SQL Server
System.Data.SqlClient.SqlClientFactory //Oracle
Now, load data
emp.LoadAll()
- Code: Select all
// Support for IEnumerator :D
foreach (Employees employee in emp) {
Console.WriteLine(employee.LastName);
}
All comments are welcome here or my email djnavi <a-t> gmail <dot> com
Change of SourceCode here
Binary here
