Click here to Skip to main content
16,009,965 members
Home / Discussions / XML / XSL
   

XML / XSL

 
GeneralRe: remove a table with xsl Pin
Yustme14-Jun-06 4:41
Yustme14-Jun-06 4:41 
GeneralRe: remove a table with xsl Pin
Elina Blank14-Jun-06 4:53
sitebuilderElina Blank14-Jun-06 4:53 
QuestionHow to validate one file using multiple schemas? Pin
Arve Bjørnerud14-Jun-06 1:58
Arve Bjørnerud14-Jun-06 1:58 
QuestionAlmost there! [modified] Pin
Arve Bjørnerud15-Jun-06 2:54
Arve Bjørnerud15-Jun-06 2:54 
Questionknow the size of DOM Pin
myvisualcplusplus13-Jun-06 19:34
myvisualcplusplus13-Jun-06 19:34 
QuestionDiff functionality for xml Pin
anidarsha13-Jun-06 19:07
anidarsha13-Jun-06 19:07 
QuestionPassing XML Data To SQL Tables Using Classic ASP Pin
rowdykuttan13-Jun-06 7:42
rowdykuttan13-Jun-06 7:42 
QuestionRead xml file into dataset (without any xml schema) [modified] Pin
kishoregolla13-Jun-06 3:59
kishoregolla13-Jun-06 3:59 
we are have to upload xml file(given by client:which consists of tally data) into sqlserver.there we are facing a problem with MasterXmlfile that has structre::

UNIT NAME="Mth" RESERVEDNAME="Mth"
NAME Mth NAME
ORIGINALSYMBOL Months ORIGINALSYMBOL
ISSIMPLEUNIT Yes ISSIMPLEUNIT
FORPAYROLL Yes FORPAYROLL
UNIT(Table)
unit is a Table and Name is attribute.... now problem is we are having to two name attribute In Unit Table...and it showing error like this "A column named 'NAME already belongs to this DataTable cannot set a nested table name to the same name" hoe to over come this "with out changing xml file"
by using C#
My code as fallows:
public partial class Testxml : System.Web.UI.Page
{
protected string table_name;
protected string column_name;
protected string cmd_string;
protected string AccessConnect;
protected string query_str;
protected int field_count;
protected DataSet data_set;
protected DataSet data_setxml;
protected DataTable data_table;
protected DataRow data_row;
protected DataRow data_row1;
protected DataColumn data_column;
protected SqlConnection Conn_one;
protected SqlCommand cmd_one;
protected SqlDataReader my_red;
protected SqlCommandBuilder data_cmb;
protected SqlDataAdapter data_adp;
protected int st_int;
protected int col_int;

protected void Page_Load(object sender, EventArgs e)
{
data_table = new DataTable();
}
protected void Button1_Click(object sender, EventArgs e)
{
if (AccessConnect != "")
{
AccessConnect = "Persist Security Info=False;User ID=sa;Password=nunetme;Initial Catalog=sat;Data Source=NUNETSERVER3";
}
Conn_one =new SqlConnection();
cmd_one = new SqlCommand();
data_set = new DataSet();
data_setxml = new DataSet();

//data_table = new DataTable();
Conn_one.ConnectionString=AccessConnect;
string strFileName="";
//strFileName =FileUpload1.FileName + ".xml";
strFileName = FileUpload1.FileName;
//strFileName = (DateTime.Now.ToShortDateString() + DateTime.Now.ToShortTimeString()).Replace("/", "").Replace(":", "").Replace(" ", "") + ".xml";
System.Object objvalue;
//Prepare file name with full path using upload directory
objvalue = System.Configuration.ConfigurationSettings.AppSettings["uploadpath"].ToString() + strFileName;

try
{
Conn_one.Open();
cmd_one.Connection = Conn_one;

data_setxml.ReadXml(objvalue.ToString());

//data_setxml.ReadXml(HttpContext.Current.Server.MapPath(objvalue.ToString()));
//data_setxml.ReadXml(HttpContext.Current.Server.MapPath(TextBox1.Text.Trim()));

foreach(System.Data.DataTable data_table in data_setxml.Tables)
{
switch (data_table.TableName.ToString())
{

case "HEADER":case "BODY":case "IMPORTDATA": case "REQUESTDESC": case "STATICVARIABLES":case "REQUESTDATA" :case "TALLYMESSAGE":
{
break;
}
//break;

case "CATEGORYALLOCATIONS.LIST":case "COSTCENTREALLOCATIONS.LIST":case "CATEGORY":case "DETAILGST.LIST":case "DETAILGST":case "HEADERGST.LIST": case "HEADERGST":case "TAXCLASSIFICATION":
{
break;
}

default:
{
//Case "CATEGORYALLOCATIONS.LIST", "COSTCENTREALLOCATIONS.LIST", "CATEGORY", "DETAILGST.LIST", "DETAILGST", "HEADERGST.LIST", "HEADERGST"

System.Text.StringBuilder dest;
dest = new StringBuilder(data_table.TableName);
dest = dest.Replace(".", "_");
table_name = dest.ToString();
// Deleting the old record updated in Temp. Tables
query_str = "Delete From " + table_name;
cmd_one = new SqlCommand(query_str);
cmd_one.Connection = Conn_one;
cmd_one.ExecuteNonQuery();

query_str = "Select * From " + table_name;
data_adp = new SqlDataAdapter(query_str, Conn_one);
data_cmb = new SqlCommandBuilder(data_adp);
data_adp.Fill(data_set, table_name);
foreach (DataRow data_row1 in data_table.Rows)
{
data_row = data_set.Tables[table_name].NewRow();
foreach (DataColumn data_column in data_table.Columns)
{
//If Column Name has "." character changed to "_" since Column name can't have "."
//and DESC reserved word the changes to be done
column_name = data_column.ColumnName;
if (data_column.ColumnName == "DESC")
{
column_name = "DESC1";
}
else
{
System.Text.StringBuilder dest1;
dest1 = new StringBuilder(data_column.ColumnName);
dest1.Replace(".", "_");
column_name = dest1.ToString();
//column_name=Replace(data_column.ColumnName,".","_");
data_row[column_name] = data_row1[data_column];
}
}
// data_set.Tables(table_name).Rows.Add(data_row)
//data_adp.Update(data_set, table_name)
data_set.Tables[table_name].Rows.Add(data_row);
data_adp.Update(data_set, table_name);

}
//Response.Write("Xml File Has Inserted Successfully");
break;
}

}

}
}
catch(Exception ex)
{
Response.Write("There is some exception please help me::" + ex.Message);
Response.Write(data_table.TableName);
Response.Write(column_name);

}
finally
{
Conn_one.Close();
}


}

}
Kindly help in this situation ....Thanks in advance.....


G.V.KISHORE
SOFTWARE ENGINEER
NUNET TECHNOLOGIES

-- modified at 10:05 Tuesday 13th June, 2006
QuestionXML Programming on Pocket PC Pin
bluehai9-Jun-06 22:40
bluehai9-Jun-06 22:40 
Questionsoap comunication Pin
joana.sa.couto9-Jun-06 3:51
joana.sa.couto9-Jun-06 3:51 
QuestionHow do i get XSL to read tags inside CDATA in an XML file and NOT parse them to "lt" or "gt"? [modified] Pin
Red_Wizard_Shot_The_Food9-Jun-06 2:50
Red_Wizard_Shot_The_Food9-Jun-06 2:50 
QuestionIE has lost XML parsing ability - pls help! Pin
Koushik Biswas7-Jun-06 8:36
Koushik Biswas7-Jun-06 8:36 
Questionto get the value by xml tag in java script (asp.net) Pin
md_hashmath7-Jun-06 6:53
md_hashmath7-Jun-06 6:53 
AnswerRe: to get the value by xml tag in java script (asp.net) Pin
Elina Blank14-Jun-06 4:55
sitebuilderElina Blank14-Jun-06 4:55 
GeneralRe: to get the value by xml tag in java script (asp.net) [modified] Pin
kishoregolla18-Jun-06 19:38
kishoregolla18-Jun-06 19:38 
GeneralRe: to get the value by xml tag in java script (asp.net) Pin
Elina Blank19-Jun-06 3:54
sitebuilderElina Blank19-Jun-06 3:54 
QuestionXML syntax for && Pin
For_IT7-Jun-06 2:15
For_IT7-Jun-06 2:15 
AnswerRe: XML syntax for && Pin
Michael Dunn7-Jun-06 3:01
sitebuilderMichael Dunn7-Jun-06 3:01 
QuestionChecking for valid XML file structure Pin
conrado76-Jun-06 3:38
conrado76-Jun-06 3:38 
AnswerRe: Checking for valid XML file structure Pin
Stephan Samuel6-Jun-06 3:43
Stephan Samuel6-Jun-06 3:43 
AnswerRe: Checking for valid XML file structure Pin
BoneSoft10-Jun-06 18:49
BoneSoft10-Jun-06 18:49 
QuestionNeed Help in XML DocType Pin
Kiran Pinjala6-Jun-06 3:10
Kiran Pinjala6-Jun-06 3:10 
QuestionUpdating the xml file in asp.net Pin
Sandeep Akhare5-Jun-06 3:41
Sandeep Akhare5-Jun-06 3:41 
AnswerRe: Updating the xml file in asp.net Pin
Sandeep Akhare7-Jun-06 23:51
Sandeep Akhare7-Jun-06 23:51 
QuestionExporting to XML Pin
Ashraj19824-Jun-06 20:23
Ashraj19824-Jun-06 20:23 

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.