Click here to Skip to main content
15,914,362 members
Home / Discussions / XML / XSL
   

XML / XSL

 
AnswerRe: developing new applications Pin
Christian Graus12-Dec-08 19:49
protectorChristian Graus12-Dec-08 19:49 
GeneralRe: developing new applications Pin
Matt Cushing13-Dec-08 15:40
Matt Cushing13-Dec-08 15:40 
GeneralRe: developing new applications Pin
evden eve nakliyat20-Dec-08 15:12
evden eve nakliyat20-Dec-08 15:12 
QuestionI'm New To XML Pin
khande200811-Dec-08 16:05
khande200811-Dec-08 16:05 
AnswerRe: I'm New To XML Pin
Christian Graus12-Dec-08 19:50
protectorChristian Graus12-Dec-08 19:50 
Questionweb service - post xml data Pin
dotnetlover_1111-Dec-08 7:01
dotnetlover_1111-Dec-08 7:01 
AnswerRe: webservice - post XML data Pin
led mike11-Dec-08 7:52
led mike11-Dec-08 7:52 
QuestionXML Explanation Pin
Vimalsoft(Pty) Ltd11-Dec-08 2:04
professionalVimalsoft(Pty) Ltd11-Dec-08 2:04 
Good Afternoon Guys , i have never attempted to save Data to the Database from the XML FILE, i have the Following

// pass an object to this function
// the attribute of the object tells the function which stored proc to call
// the object itself is serialized to an xml string and passed to the database
// the stored proc on the other side takes care of the behind the scenes details
public static string SaveObjectToDB(object obj)
{
    string sql = "", xml = "", result = "";
    // populate the object from the database using the specified ID
    // loop through the attributes of the object/class
    // Look up the stored procedure attribute on the object to use the appropriate stored proc to save the object
    foreach (Attribute attr in obj.GetType().GetCustomAttributes(true))
    {
        DBStoredProcAttribute dbSPAttr = attr as DBStoredProcAttribute;
        // check if the attribute is a DBStoredProcAttribute
        if (dbSPAttr != null)
        {
            // serialize the object to xml
            xml = SerializeObjectToXML(obj);
            // trim of the xml headers
            // Subject Structures can be longer than 8000 characters so must trim off the prefix in .Net for SubjectStructure objects
            xml = xml.Replace("\\r\\n", "").Replace("\r\n", "").Replace("<?xml version=\"1.0\" encoding=\"utf-16\"?>", "");
            int StartPos=0;
            StartPos = xml.IndexOf("<SubjectStructure>");
            if (StartPos > 0)
            {
                xml = xml.Substring(StartPos);
            }
            // run the sp for this type of object passing the xml for the object
            sql = dbSPAttr.SaveObjectSP + "'" + xml.Trim() + "'";       // stored proc for SaveObject ;

            // execute the stored proc
            result = ExecuteStoredProc(sql);
        }
    }

    return result;
}


Can you please help Explain this Function code.If i can Directly save the data to the Database, why should i put it to XML First then SQL

Thanks

Vuyiswa Maseko,

Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding

VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za


QuestionRe: XML Explanation Pin
led mike11-Dec-08 5:52
led mike11-Dec-08 5:52 
AnswerRe: XML Explanation Pin
Vimalsoft(Pty) Ltd11-Dec-08 18:56
professionalVimalsoft(Pty) Ltd11-Dec-08 18:56 
Questionxsd restriction Pin
User 5838528-Dec-08 15:44
User 5838528-Dec-08 15:44 
QuestionNeed help.. Pin
raveen8-Dec-08 7:28
raveen8-Dec-08 7:28 
QuestionRe: Need help.. Pin
led mike8-Dec-08 7:40
led mike8-Dec-08 7:40 
QuestionShowing Image Pin
amit sahu207-Dec-08 19:58
amit sahu207-Dec-08 19:58 
AnswerRe: Showing Image Pin
Christian Graus11-Dec-08 14:46
protectorChristian Graus11-Dec-08 14:46 
QuestionProblem: How to sort a XML file into another XML File ? Pin
zouzoulikou4-Dec-08 7:03
zouzoulikou4-Dec-08 7:03 
QuestionRe: Problem: How to sort a XML file into another XML File ? Pin
led mike4-Dec-08 7:37
led mike4-Dec-08 7:37 
AnswerRe: Problem: How to sort a XML file into another XML File ? Pin
TJS4u4-Dec-08 23:05
TJS4u4-Dec-08 23:05 
Question[Message Deleted] Pin
zouzoulikou4-Dec-08 6:49
zouzoulikou4-Dec-08 6:49 
AnswerRe: How to sort a XML file into another XML File Pin
zouzoulikou4-Dec-08 6:53
zouzoulikou4-Dec-08 6:53 
QuestionXSD Conditional Elements Pin
Skippums3-Dec-08 7:24
Skippums3-Dec-08 7:24 
QuestionI want to use search of a website through my application Pin
IrfanHaleem2-Dec-08 7:15
IrfanHaleem2-Dec-08 7:15 
AnswerCross Post Pin
led mike3-Dec-08 8:00
led mike3-Dec-08 8:00 
QuestionJavascript in xsl Pin
Ashvish2-Dec-08 0:47
Ashvish2-Dec-08 0:47 
QuestionRe: Javascript in xsl Pin
led mike2-Dec-08 5:20
led mike2-Dec-08 5:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.