oledb连接oracle的疑问
protected void Page_Load(object sender, EventArgs e)
{
DataTable dsRecords = new DataTable();
OleDbConnection oledbcon = new OleDbConnection(System.Configuration.ConfigurationManager.ConnectionStrings["OledbCon"].ToString());
oledbcon.Open();
OleDbCommand cmd = new OleDbCommand("LOGINVALIDATE", oledbcon);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@AccountID", OleDbType.VarChar);
cmd.Parameters["@AccountID"].Value = "091110421";
cmd.Parameters.Add("@PassWord", OleDbType.VarChar);
cmd.Parameters["@PassWord"].Value = "000000";
cmd.Parameters.Add("@res", OleDbType.VarChar, 50);
cmd.Parameters["@res"].Direction = ParameterDirection.Output;
OleDbDataAdapter adp = new OleDbDataAdapter(cmd);
adp.Fill(dsRecords);
GridView1.DataSource = dsRecords;
GridView1.DataBind();
//Label1.Text = dsRecords.Rows[0].ItemArray[0].ToString();
//OleDbDataAdapter adp = new OleDbDataAdapter(cmd);
//cmd.ExecuteNonQuery();
//Label1.Text = cmd.Parameters["@res"].Value.ToString();
}
已上是我写的访问访问代码,输出参数已经被验证过没问题(注释部分就是),但是为什么往datatable fill的时候,结果总是为空,就是dsRecords里什么也没有。 --------------------编程问答-------------------- 你的存储过程是什么哦? --------------------编程问答--------------------
protected void Page_Load(object sender, EventArgs e)
{
DataTable dsRecords = new DataTable();
OleDbConnection oledbcon = new OleDbConnection(System.Configuration.ConfigurationManager.ConnectionStrings["OledbCon"].ToString());
oledbcon.Open();
OleDbCommand cmd = new OleDbCommand("LOGINVALIDATE", oledbcon);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@AccountID", OleDbType.VarChar);
cmd.Parameters["@AccountID"].Value = "091110421";
cmd.Parameters.Add("@PassWord", OleDbType.VarChar);
cmd.Parameters["@PassWord"].Value = "000000";
cmd.Parameters.Add("@res", OleDbType.VarChar, 50);
cmd.Parameters["@res"].Direction = ParameterDirection.Output;
cmd.Parameters.Add("@power", OleDbType.VarChar, 50);
cmd.Parameters["@power"].Direction = ParameterDirection.Output;
OleDbDataAdapter adp = new OleDbDataAdapter(cmd);
adp.Fill(dsRecords);
GridView1.DataSource = dsRecords;
GridView1.DataBind();
//cmd.ExecuteNonQuery();
//Label1.Text = cmd.Parameters["@res"].Value.ToString();
}
--------------------编程问答--------------------
create or replace procedure loginValidate(studentNumber in varchar2, password in varchar2, res out varchar2, power out number) is
begin
select ACCOUNT_ID, ROLE into res, power FROM SYSTEM.ACCOUNT where ACCOUNT_ID= studentNumber AND PASSWRD = password;
EXCEPTION
WHEN No_data_found THEN
res :='0000';
power :=100;
end loginValidate;
只能说你真有才。
补充:.NET技术 , 非技术区