Hello Friends,
here i am trying to generate one XML file & one XSD file from my dataset,
Instead of any physical location
i am trying to write those file in MemoryStream,
Problem is, while both file i am returning in the form of "string" from my
action function ("Hotelier_XMLReport" look bellow ).
Now How do i read the string after receiving ? ...i am getting
"#20028;#30565;#24900;#24948;#25939;#8308;#15919;"
PLEASE HAVE A LOOK AT THE CODE ..& GIVE ME A SOLUTION
string XmlPath="",XsdPath="";
objRpt.Hotelier_XMLReport(Session["Hotel_Id"].ToString(),Session["currentHotel"].ToString(),Session["Rpt_Name"].ToString(),Fields,ref
XmlPath,ref XsdPath);
Please have a look at Function
=================================
public bool Hotelier_XMLReport(string Hotel_Id,string HotelName,string
TableName, ArrayList Arry_Fields,ref string XmlPath,ref string XsdPath)
{
Database objDB=new Database();
objDB.OpenConnection();
string strFields="";
for (int i=0;i<Arry_Fields.Count;i++)
{
strFields = strFields + Arry_Fields[i] +",";
}
//remove the last comma ","
strFields = strFields.Remove((strFields.Length-1),1);
string SqlQry="Select "+ strFields +" from "+ TableName +" where
Hotel_Id='"+ Hotel_Id.Replace("'","''") +"' and HotelName='"+
HotelName.Replace("'","''") +"'";
SqlDataAdapter sqlAdap=new SqlDataAdapter(SqlQry,objDB.mysqlconn);
DataSet Ds=new DataSet();
sqlAdap.Fill(Ds,"MyTable") ;
try
{
MemoryStream objMs_XML=new MemoryStream(5000);
MemoryStream objMs_XSD=new MemoryStream(5000);
Ds.WriteXml(objMs_XML);
Ds.WriteXmlSchema(objMs_XSD);
//char [] charArray;
byte [] byteArray;
int count;
UnicodeEncoding uniEncoding = new UnicodeEncoding();
objMs_XML.Seek(0,SeekOrigin.Begin);
byteArray = new byte[objMs_XML.Length];
count = objMs_XML.Read(byteArray, 0, (int)objMs_XML.Length);
XmlPath = uniEncoding.GetString(byteArray,0,count);
byte [] Xsd_byteArray;
int Xsd_count;
UnicodeEncoding Xsd_uniEncoding = new UnicodeEncoding();
objMs_XSD.Seek(0,SeekOrigin.Begin);
Xsd_byteArray = new byte[objMs_XSD.Length];
Xsd_count = objMs_XML.Read(byteArray, 0, (int)objMs_XSD.Length);
XsdPath = uniEncoding.GetString(Xsd_byteArray,0,Xsd_count);
objDB.closeConnection();
return true;
}
catch
{ objDB.closeConnection();
return false;
}
}
Thanks & Regards
Arindam
Web Designer & Developer
Yahoo! India Matrimony: Find your life partneronline.
[Non-text portions of this message have been removed]
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/