Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Datagridview - Checkbox
Message
De
06/06/2006 14:07:47
 
Information générale
Forum:
ASP.NET
Catégorie:
Formulaires
Versions des environnements
Environment:
C# 2.0
Divers
Thread ID:
01127422
Message ID:
01127437
Vues:
10
This is the code to create a qbxml file and sending it to QB:
            XmlDocument inputXMLDoc = new XmlDocument();
            inputXMLDoc.AppendChild(inputXMLDoc.CreateXmlDeclaration("1.0", null, null));
            inputXMLDoc.AppendChild(inputXMLDoc.CreateProcessingInstruction("qbxml", "version=\"2.0\""));
            XmlElement qbXML = inputXMLDoc.CreateElement("QBXML");
            inputXMLDoc.AppendChild(qbXML);
            XmlElement qbXMLMsgsRq = inputXMLDoc.CreateElement("QBXMLMsgsRq");
            qbXML.AppendChild(qbXMLMsgsRq);
            qbXMLMsgsRq.SetAttribute("onError", "stopOnError");
            XmlElement itemQryRq = inputXMLDoc.CreateElement("ItemInventoryQueryRq");
            qbXMLMsgsRq.AppendChild(itemQryRq);

            XmlElement itemNameRq = inputXMLDoc.CreateElement("FullName");
            itemNameRq.InnerText = "563";
            itemQryRq.AppendChild(itemNameRq);

            itemNameRq = inputXMLDoc.CreateElement("FullName");
            itemNameRq.InnerText = "ND-105";
            itemQryRq.AppendChild(itemNameRq);

            string input = inputXMLDoc.OuterXml;
            //step3: do the qbXMLRP request
            RequestProcessor2 rp = null;
            string ticket = null;
            string response = null;
            try
            {
                rp = new RequestProcessor2();
                rp.OpenConnection("", "IDN Inventory Item Request");
                ticket = rp.BeginSession("", QBFileMode.qbFileOpenDoNotCare);
                response = rp.ProcessRequest(ticket, input);

            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("COM Error Description = " + ex.Message, "COM error");
                return;
            }
            finally
            {
                if (ticket != null)
                {
                    rp.EndSession(ticket);
                }
                if (rp != null)
                {
                    rp.CloseConnection();
                }
            };

            //step4: parse the XML response and show a message
            XmlDocument outputXMLDoc = new XmlDocument();
            outputXMLDoc.LoadXml(response);
There is a section in the above where I'm doing 2 "CreateElements" with "FullName". Which is the item key. I don't have the SDK with me, but I remember that you can pass either FullName or one other column to retrieve individual items.

This above isn't exactly perfect. It's a combination of reading how to accomplish XML in C# 2.0 and QB examples which are done in V1.0, I think. The books recommend XmlDataDocument, added in V2.0, but I haven't tried it yet.

Is this what you're looking for?


>Avoiding your checkbox question, are you searching the QB database before adding new ITEMS or are you just flagging items as having already been exported to QB? I have been using "nSoftware's IBIZ QB control" (http://www.nsoftware.com/ibiz/QuickBooks/) and the earlier version that i have doesnt provide for searching of items. Do you have some code u can share on how thats done?
>
>
>>I'm creating a little system to interface to quickbooks inventory. I want the user to hit a button that will populate the system with the inventory items from qb. Then click a checkbox in the grid that will indicate which items that are necessary for the process.
>>
>>Using the smarttags I've added a checkbox column to the grid. Then in code, after I've retrieved the xml file from qb, I add 2 more columns for the item key and description.
>>
>>I noticed a little issue. If I click on any of the grid columns to reorder the grid, any checks are cleared.
>>
>>Any suggestions on what I need to set for the checkboxes to maintain their values?
>>
>>Thanks,
>>
>>PF

(On an infant's shirt): Already smarter than Bush
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform