asp.net(c#) 执行sql和参数赋值得问题
using (SqlConnection conn = new SqlConnection(Resources.Resource.ConnString))
{
conn.Open();
string typeid = "1 ";
using(SqlCommand comm = new SqlCommand ( "select * from vvmessage where typeid=@typeid order by createtime desc ",conn))
{
comm.Parameters.AddWithValue( "@typeid ", typeid);
using(SqlDataReader dr = comm.ExecuteReader())
{
Response .Write (dr.HasRows );
}
}
}
这段代码运行正常,
但放到 orcle数据库上,用以下代码,就报错了呢?
using (OleDbConnection conn = new OleDbConnection(Resources.Resource.ConnectionString))
{
conn.Open();
string typeid = "1 ";
using (OleDbCommand comm = new OleDbCommand ( "select * from vvmessage where typeid=@typeid order by createtime desc ", conn))
{
comm.Parameters.AddWithValue( "@typeid ", typeid);
using (OleDbDataReader dr = comm.ExecuteReader())
{
Response.Write(dr.HasRows);
}
&