asp.net 封装oledb数据库访问类的问题
public void SqlExecute(string sql, OleDbParameter[] arrParm)
{
try
{
OleDbConnection conn = new OleDbConnection(Resources.Resource.ConnectionString);
OleDbCommand comm = new OleDbCommand(sql, conn);
if (arrParm != null)
{
foreach (OleDbParameter parameter in arrParm)
{
comm.Parameters.Add(parameter);
}
}
conn.Open();
comm.ExecuteNonQuery();
comm.Dispose();
conn.Close();
conn.Dispose();
}
catch (
System.Data.SqlClient.SqlException ex)
{
throw new Exception(ex.Message);
}
}
请问,对于这个类再调用的时候,如何把arrParm 传入??
调用:
dbconn db = new dbconn ();
db.SqlExecute( "INSERT INTO CITYINFO (CITYCODE, AREACODE, CITYINFO) VALUES ( :citycode,:areacode ,:cityinfo ) ", parme);
不知道这个parme 怎么定义和赋值??
在线等,分不够可以加!
------解决方案--------------------OleDbParameter[] arrParm = { new OleDbParameter( "@aaa ",OleDb.DbTyp