Click here to Skip to main content
15,892,298 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a program to validate addresses, right now I am using this console app by calling it with two procedures one for input address and another for output address.

The first procedure returns the list of addresses to be validated and the second one updates validated addresses back to the table.

From console (c#) app I am calling the first procedure, validating each address and calling the second proc by passing values of the validated address

Recently the webservice exposed a new method for validating addresses in bulk. I am looking for a solution to have only one get proc and one set proc to update any table with addresses so the same console can be used by other processes.

Below is the XML I have thought of to pass to the proc. How can I build a dynamic sql to update the table ?

XML
<AddressValidator>
    <ValidationResults>
        <ExtensionData />
        <Results>
            <ValidationResult>
                <ExtensionData />
                <ReturnCode>-1</ReturnCode>
                <ErrorCode>491</ErrorCode>
                <ErrorMessage>Failed DPV because of invalid primary</ErrorMessage>
                <CASSDate>0</CASSDate>
                <ValidatedAddress>
                    <ExtensionData />
                    <InputAIID />
                    <ID>501</ID>
                    <AddressLine1 />
                    <AddressLine2 />
                    <City />
                    <State />
                    <ZipCode />
                    <County />
                    <MailRoomServer />
                    <FirstName />
                    <LastName />
                    <Business />
                </ValidatedAddress>
            </ValidationResult>
        </Results>
    </ValidationResults>
    <Mappings>
        <Map_Type>Input</Map_Type>
        <Data_Table>Addresstable</Data_Table>
        <AddressLine1>MAIL_ADDR1</AddressLine1>
        <AddressLine2>MAIL_ADDR2</AddressLine2>
        <City>MAIL_CITY</City>
        <State>MAIL_STATE</State>
        <ZipCode>MAIL_ZIP</ZipCode>
        <isBadAddress>BadAddressYN</isBadAddress>
        <ErrorCode>SatoriErrCode</ErrorCode>
        <ID>ID</ID>
    </Mappings>
    <Mappings>
        <Map_Type>Output</Map_Type>
        <Data_Table>Addresstable</Data_Table>
        <AddressLine1>VAL_MAIL_ADDR1</AddressLine1>
        <AddressLine2>VAL_MAIL_ADDR2</AddressLine2>
        <City>VAL_MAIL_CITY</City>
        <State>VAL_MAIL_STATE</State>
        <ZipCode>VAL_MAIL_ZIP</ZipCode>
        <isBadAddress>BadAddressYN</isBadAddress>
        <ErrorCode>ErrCode</ErrorCode>
        <ID>ID</ID>
    </Mappings>
</AddressValidator>
Posted
Updated 8-Apr-14 7:23am
v5
Comments
CHill60 8-Apr-14 12:24pm    
What have you tried? There is no code here so we can't tell what you are doing
Marv C 8-Apr-14 12:27pm    
HAven't tried anything yet but looking for ideas on how to acheive this.
ZurdoDev 8-Apr-14 12:48pm    
I don't see where you are stuck or what you are needing.
Marv C 8-Apr-14 12:58pm    
Ryan just added a bit more info above...
RDBurmon 13-May-14 14:57pm    
Do you need to update
1) Many addresses in many tables
Or
2) Many addresses in one table

1 solution

Please update your data using Table-Valued Parameters (http://msdn.microsoft.com/en-us/library/bb675163%28v=vs.110%29.aspx[^])

or TableAdapter (http://msdn.microsoft.com/en-us/library/bz9tthwx.aspx[^]

with this way you can add/Update Multiple rows or multiple tables.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900