Select to view content in your preferred language

Query results to databsae

768
1
08-10-2012 07:55 AM
jamesborris
Occasional Contributor
can anyone point me in the right direction to writing query results to a database. Id like to select records then have an option to submit them to our SDE oracle database. I do not need the geometries, just the IDs really. Anything will help. Thanks.
0 Kudos
1 Reply
JMcNeil
Deactivated User
James,

I'm not sure entirely what you are trying to accomplish.  You have a table in SDE oracle and you want to write records to that table?   You have to add that table as a feature layer so you can write to it.  Add it to you mxd/msd and publish it as a feature layer and then write away.  Once it is added as a feature layer you can write some query tools to query it and then display that information in a Feature Data Grid or Form. I would maybe bind it to a FeatureDataGrid (see the sample gallery for that...easy straight forward)  and then add a button to the feature data grid or form to add a new record.  Something like this:

 <Button x:Name="AddNewRow" Margin="5,0" Style="{StaticResource MenuButtonStyle}" Click="addrowButton_Click">
                                                                <TextBlock Margin="5" Text="Add a new record" VerticalAlignment="Center"/>
                                                            </Button>




and the add button code would look something like this:

 private void addrowButton_Click(object sender, RoutedEventArgs e)
        {
            var g = new Graphic();
            if (l != null && l.LayerInfo != null && l.LayerInfo.Fields != null)
            {
                foreach (var f in l.LayerInfo.Fields)
                {
                     // if you want to prepopulate fields add that info here: something like -  
                    //g.Attributes["DateTime"] = DateTime.UtcNow;
                   
                   
                    
                }
            }
            else
            {
                
                //g.Attributes["DateTime"] = DateTime.UtcNow;
               

            }
            l.Graphics.Add(g);
        }



Hope that helps
Jay
0 Kudos