C# .NET - How to insert data to tally a/c software using c#

Asked By Rohit Warghade on 26-May-11 01:38 AM
Hi to all,

Please help me for how to insert data into tally accounting software,i want how to write xml to send data in perticular a/c in tally. please help me ASAP.
i have already code from following URLS


i don't want to create group i want insert data that is give input by user into tally in particular account

Rohit Warghade.
Mahendar Nanamala replied to Rohit Warghade on 26-May-11 01:52 AM
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;

namespace RTSlink001
{ public partial class Form1 : Form
               //RTSlink DLL functions declaration
               [DllImport("RTSLink.dll")] extern static int Open();
               [DllImport("RTSLink.dll")] extern static int Send(string request);
               [DllImport("RTSLink.dll")] extern static string ResponseText(); 

               public Form1()
              { InitializeComponent();

              //This is the button code which gets executed when the Button is clicked 
              private void button1_Click(object sender, EventArgs e) 
                  string strResponse = null; 
                  string strXMLfile = ""; 
                  int n = 0; 

                  //XML String that contains request to be sent to Tally Software
                  //This request will create a Group called 'My Debtors'
                  strXMLfile = "<ENVELOPE><HEADER><TALLYREQUEST>Import Data</TALLYREQUEST></HEADER>
                         <REQUESTDESC><REPORTNAME>All Masters</REPORTNAME></REQUESTDESC>
                         <REQUESTDATA><TALLYMESSAGE xmlns:UDF='TallyUDF'>
                         <GROUP NAME='My Debtors' ACTION='Create'>
                         <NAME.LIST><NAME>My Debtors</NAME></NAME.LIST>
                         <PARENT>Sundry Debtors</PARENT>

                 //Invoke RTSlink DLL Open() function to check whether Tally is running or not ?
                 //Zero means Tally Software is running.
                 n = Open();
                 if (n == 0)
                      //Invoke Send() function of RTSlink DLL
                      //Send request to Write data to Tally (Create a Group named "My Debtors")
                      if (Send(strXMLfile) == 0)
                           //Invoke ResponseText() of RTSlink DLL 
                            strResponse = ResponseText();
                            MessageBox.Show(strResponse, "Group Created Successfully");
                            MessageBox.Show("Send() function failed", "Send() error");
                      MessageBox.Show("Cannot connect to Tally", "Tally not running"); 

Anoop S replied to Rohit Warghade on 26-May-11 03:16 AM
You can consider tally as a database and Use the namespace


and for connection string

Dim query As String = "query string"
Dim source As String = "PORT=9000;DRIVER=Tally ODBC Driver;SERVER={(local)}"
Dim con As OdbcConnection
con = New OdbcConnection(source)

from where you are inserting? from some textbox values or xml file? if you are insertion from textbox values you can insert using the  Insert command which is using same as in sql like
INSERT INTO tablename VALUES ('value1' etc...)
or if you are using XML file you can download code for that from