和上这次. 我第三次. 帖这个东西了. 都没人看的啊.
*
This computer source code is Copyright 2003 AmoyStudio
All Rights Reserved.
Permission to use, copy, modify, and distribute this computer source code (Source Code),
but .Don't forget add this CopyRight info into source...
it's a freeware.. enjoy
btw: If you modified this code , you'd better send it to me .I will add it and republicsh it to everybody.Sure,I will sign your name too...
Use Example:
----------------------------------------------------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------------------------------------------------
1.simply Exec Sqlstr:
public void DoSql()
{
SqlOperator.oSqlConnStr=@"password=noneed;user id=albert;data source=218.5.74.183;initial catalog=Albert"//<----Define default Connection string for this Appliction ,one Appliction only need define .in one place.
using(SqlOperator myOperator=new SqlStr("select * from Test"))
{
myOperator.Exec();
}
}
// GetConnection returns IDbConnection
public IDbConnection GetConnection(int connType,
string connString)
{
switch(connType)
{
case 1: // OleDb Data Provider
idbConn = new OleDbConnection(connString);
break;
case 2: // Sql Data Provider
idbConn = new SqlConnection(connString);
break;
// case 3: // ODBC Data Provider
// idbConn = new OdbcConnection(connString);
// break;
// case 3: // Add your custom data provider
default:
break;
}
return idbConn;
}
// GetDataAdapter returns IDbDataAdapter
public IDbDataAdapter GetDataAdapter(int connType,
string connString, string sql)
{
switch(connType)
{
case 1: // OleDb Data Provider
idbAdapter = new OleDbDataAdapter(sql, connString);
break;
case 2: // Sql Data Provider
idbAdapter = new SqlDataAdapter(sql, connString);
break;
// case 3: // ODBC Data Provider
// idbAdapter = new OdbcDataAdapter(sql, connString);
// break;
// case 3: // Add your custom data provider
default:
break;
}
return idbAdapter;
}
}
}