`
starnc
  • 浏览: 145044 次
  • 性别: Icon_minigender_1
  • 来自: 火星
社区版块
存档分类
最新评论

ORA-01036: 非法变量名/编号,oracle的特有错误

    博客分类:
  • .NET
阅读更多

Oracle特有的错误,sqlserver是用@来表示变量,Oracle居然用:,小弟真是服了,这种错误,是个人就找不出来。

 

         string connstr = DbHelperOra.connectionString;
            OracleConnection conn = new OracleConnection(connstr);
            conn.Open();
            string sqlstr = "select count(*) from t_dm_gy_swry where swry_dm=:username and userpassword=:pwd";
            OracleCommand cmd = new OracleCommand(sqlstr, conn);
            cmd.Parameters.AddWithValue(":username", username);
            cmd.Parameters.AddWithValue(":pwd", pwd);

            string i=Convert.ToString(cmd.ExecuteOracleScalar());
      
            if (i.Equals("1"))
            {
                Model.T_DM_GY_SWRY t=new Model.T_DM_GY_SWRY();
                string strsql="select * from t_dm_gy_swry where swry_dm=:username";
                OracleParameter[] myParm = new OracleParameter[] { new OracleParameter(":username",OracleType.VarChar,100)};

                myParm[0].Value = username;
                DataSet ds = DbHelperOra.Query(strsql,myParm);
                DataRow dr = ds.Tables[0].Rows[0];
                t.MC = dr["MC"].ToString();
                return t;

            }
            else
            {
                return null;
            }
            conn.Close();

 

分享到:
评论
1 楼 taotaonwsuaf 2010-06-25  
多谢楼主,我也遇到这个问题,找了好长时间都没有找到,,,

相关推荐

Global site tag (gtag.js) - Google Analytics