C# 如何根据一列的数据查找另外一列对应的列值
比如说我用的oracle数据库中有一个表table,它有三个列名:Id、 Name、 Description.
我现在想要用id来查Description,语句该怎么写呢?求各路大神赐教,小弟感激不已!
------解决方案--------------------
using (OracleConnection connection = new OracleConnection(connectionString))
{
OracleCommand cmd = new OracleCommand(OracleString, connection);
System.Data.OracleClient.OracleParameter myParameter = new System.Data.OracleClient.OracleParameter("@id", OracleType.类型);
myParameter.Value = id;
cmd.Parameters.Add(myParameter);
try
{
connection.Open();
int rows = cmd.ExecuteNonQuery();
return rows;
}
catch (System.Data.OracleClient.OracleException E)
{
throw new Exception(E.Message);
}
finally
{
cmd.Dispose();
connection.Close();
}
}
------解决方案--------------------
参考http://blog.csdn.net/chinajiyong/article/details/7318579