求助,C#查询oracle数据库返回行数的问题
如题,就是要返回table表的行数,本人不熟悉oracle的操作,请好心人帮我把下面的代码补全,只要得到行数就行。OracleConnectionconn=newOrac...
如题,就是要返回table表的行数,本人不熟悉oracle的操作,请好心人帮我把下面的代码补全,只要得到行数就行。
OracleConnection conn = new OracleConnection();
conn.ConnectionString = ....
OracleCommand cmd = conn.CreateCommand();
cmd.CommandText = "select * from table";
conn.Open(); 展开
OracleConnection conn = new OracleConnection();
conn.ConnectionString = ....
OracleCommand cmd = conn.CreateCommand();
cmd.CommandText = "select * from table";
conn.Open(); 展开
3个回答
展开全部
......
OracleDataAdapter adp= new OracleDataAdapter("select * from table", conn);
DataTable tbl = new DataTable();
adp.Fill(tbl);
int rowCount = tbl.Rows.Count();
OracleDataAdapter adp= new OracleDataAdapter("select * from table", conn);
DataTable tbl = new DataTable();
adp.Fill(tbl);
int rowCount = tbl.Rows.Count();
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
OracleConnection conn = new OracleConnection();
conn.ConnectionString = ....
conn.Open();
OracleCommand cmd = conn.CreateCommand();
cmd.CommandText = "select count(*) from table";
int count = cmd.ExecuteScalar();
conn.ConnectionString = ....
conn.Open();
OracleCommand cmd = conn.CreateCommand();
cmd.CommandText = "select count(*) from table";
int count = cmd.ExecuteScalar();
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询