MARKAND911 -1 Junior Poster

How to update database table using commandbuilder without having Primary Key.

We Tried this Attempt;

obj.con = obj.Class_DBConnection();
            OracleCommand cmd = new OracleCommand();
            string fromsrvno = "000000067334";
            string tosrvno = "000000067350";
            qryStr = "select distinct * from  test_m_srvdetail  where SDBM_SERVICE_NO between'" + fromsrvno + "' and '" + tosrvno + "'";
            //qryStr = "TEST_UP";            
            //cmd.CommandType = CommandType.StoredProcedure;
            //cmd.CommandText = "TEST_UP";
            //cmd.Connection = obj.con;
            //cmd.Parameters.Add("v_refcur", OracleType.Cursor).Direction = ParameterDirection.Output;      
            //da = new OracleDataAdapter(cmd);          
            da = new OracleDataAdapter(qryStr, obj.con);
            build = new OracleCommandBuilder(da);
            da.MissingSchemaAction = MissingSchemaAction.AddWithKey;   
            ds = new DataSet();
            //ds = da.ReturnProviderSpecificTypes;              
            //da.FillSchema(ds, SchemaType.Source, "test_m_srvdetail");
            //ds.Tables["test_m_srvdetail"].PrimaryKey = new DataColumn {ds.Tables["test_m_srvdetail"].Columns["SDBM_SERVICE_NO"]}   
            //ds.Tables[0].PrimaryKey = ds.Tables[0].Columns[0];            

            da.Fill(ds, "test_m_srvdetail");
            ds.Tables[0].Constraints.Add("pk_sid", ds.Tables[0].Columns["SDBM_SERVICE_NO"], true);
            ds.Tables[0].AcceptChanges();
 
           // da.FillSchema(ds, SchemaType.Source, "test_m_srvdetail");
            da.FillSchema(ds, SchemaType.Mapped, "test_m_srvdetail");
            da.Update(ds.Tables[0]);
            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                ds.Tables[0].Rows[i]["SDBM_CURRENT_BILL_AMT"] = 1000;
                ds.Tables[0].Rows[i]["SDBM_BALANCE_BILL_AMT"] = 1000;
            }

            //ds.Tables[0].AcceptChanges();
            
            da.UpdateCommand = build.GetUpdateCommand();
            //OracleCommand updatecommnad = new OracleCommand();
            //updatecommnad.CommandText = "update table test_m_srvdetail  where SDBM_SERVICE_NO between'" + fromsrvno + "' and '" + tosrvno + "'";
           
            da.Update(ds.Tables[0]);

We Are using this error:
Dynamic SQL generation for the UpdateCommand is not supported against a SelectCommand that does not return any key column information.