Click here to Skip to main content
15,179,684 members

Comments by connect2manas (Top 31 by date)

connect2manas 19-Nov-13 2:02am View
   
i have a nested list class like as below
public class RestListInfo
{
public int ErrorCode { get; set; }
public string ErrorMessage { get; set; }
[XmlElement("RESTListInfoResponse")]
public List<restlistinforesponse> RESTInfoResponseList = new List<restlistinforesponse>();
}

public class RESTListInfoResponse
{
[XmlElement("TemplateEntity")]
public List<template>
connect2manas 19-Nov-13 1:47am View
   
Hi RK,
Actually TemplateEntityList .count() has 1 record.
But templatesetset .count() has 14 records.
so looping happens only once.
connect2manas 19-Nov-13 1:42am View
   
You are right.
TemplateEntityList .count() has 1 record.
But templatesetset .count() has 14 records.
so templatesetset[0].TemplateID=101;
templatesetset[1].TemplateID=200;
templatesetset[3].TemplateID=899;
as on display.
so how can i iterate all the values .please help me.
connect2manas 19-Nov-13 1:28am View
   
TemplateEntityList contains 14 list.so templatesetset .count() also contains 14 list.
connect2manas 26-Sep-13 4:00am View
   
thanks for your answer.
But there is no fix fields like c1,c2,cn .so that we can not define that.
connect2manas 10-Sep-13 7:19am View
   
i have not done
please give some idea
connect2manas 9-Aug-13 7:10am View
   
Hi All,
this is the stored procedure.
After Execution error:

Msg 128, Level 15, State 1, Line 1
The name "User_Name" is not permitted in this context. Valid expressions are constants, constant expressions, and (in some contexts) variables. Column names are not permitted.


alter procedure TestFirst
as
DECLARE @User_Name varchar(50);
DECLARE @User_Id int;
DECLARE @Client_Id int;
DECLARE @UserLogId bigint
DECLARE @NewDB nvarchar(max);
DECLARE @ParmUserLogId nvarchar(500);
set @User_Name='mks';
set @User_Id=438;
set @Client_Id=4
SET @NewDB='ta.dbo.user_log ( CLIENT_ID,USER_ID,USER_NAME,LOGIN_TIME)'
DECLARE @sqlQueryUserLogId nvarchar(MAX)
SET @sqlQueryUserLogId='insert into '+ @NewDB+' values( User_Name=''' + @User_Name + ''' ,User_ID=''' + cast(@User_Id as varchar(20)) + ''' , Client_Id='''+cast(@Client_Id as varchar(20))+''',LOGIN_TIME=GetDate()) SELECT @UserLogId = SCOPE_IDENTITY() ';
SET @ParmUserLogId= N'@UserLogId INTEGER OUTPUT'
EXEC sp_executesql @sqlQueryUserLogId,@ParmUserLogId, @UserLogId OUTPUT
set @UserLogId=@UserLogId;

exec TestFirst
connect2manas 6-Aug-13 13:24pm View
   
thanks for you answer.
connect2manas 6-Aug-13 2:40am View
   
Hi leuva,
Thanks for your answer.
but in above loggedin contain null value.
connect2manas 26-Jul-13 5:45am View
   
Alter procedure MultDB
as
select * from ta.dbo.user_master

declare @ScndDB varchar(100);
declare @sql varchar(MAX);

set @ScndDB ='[Theorem_Analytics_database].dbo.User_Master';

SET @SQL='SELECT User_Email,First_Name,Last_Name FROM '+@ScndDB

EXEC (@SQL)



Now i want to store the User_Email,First_Name,Last_Name in different varible.
plz help me.
connect2manas 26-Jul-13 5:25am View
   
thanks ,its coming.
Sir if i want to get particular fields of @ScndDb Table,then what i have to do?
please reply me.
connect2manas 26-Jul-13 3:59am View
   
Hi,
Thanks for reply.
please help me.

Now my Procedure Becomes like below:

Alter procedure MultDB
as
select * from ta.dbo.user_master

declare @ScndDB varchar(100);
set @ScndDB ='[Theorem_Analytics_database].dbo.User_Master';

DECLARE @Command VARCHAR(MAX)
SET @Command='SELECT * FROM ' +@ScndDB
EXEC @Command


Command(s) completed successfully.

Exec MultDB;
First Table data displaying only.
for second error
connect2manas 23-Jul-13 0:33am View
   
it is working perfectly for English characters.but not for chinese,japanese...
connect2manas 10-Jul-13 5:12am View
   
output should be
1 2 3 4 5
11 322 32 45
10 20 30 40 50
20 21 12 13 14


6 7 8 9 10
65 76 5 66 77 5
60 70 80 90 100


like this..
connect2manas 9-Jul-13 8:12am View
   
no it is not correct
connect2manas 5-Jul-13 8:44am View
   
using System;
using System.IO;

using iTextSharp.text;
using iTextSharp.text.xml;
using iTextSharp.text.pdf;

public class XmlToPdf {

public static void Main() {

Console.WriteLine("XML to PDF conversion example");

// step 1: creation of a document-object
Document document = new Document();

try {

// step 2:
// we create a writer that listens to the document
// and directs a XML-stream to a file
PdfWriter.GetInstance(document, new FileStream("XMLFile3.pdf", FileMode.Create));

// step 3: we create a parser
ITextHandler xmlHandler = new ITextHandler(document);

// step 4: we parse the document
xmlHandler.Parse("XMLFile1.xml");
}
catch (Exception e) {
Console.Error.WriteLine(e.StackTrace);
Console.Error.WriteLine(e.Message);

if (e.InnerException != e) {
Console.Error.WriteLine(e.InnerException.Message);
}
}
finally {
Console.WriteLine("Finished - Hit any enter to close this window.");
}

Console.ReadLine();
}
}
connect2manas 5-Jul-13 8:38am View
   
Adobe Reader could not open the File.it is either not a supported file or damaged file.
connect2manas 5-Jul-13 8:32am View
   
i had gone through the link: but not happening.
http://www.dotnetfunda.com/forums/thread2904-convert-xml-to-pdf-using-itextsharp.aspx
connect2manas 5-Jul-13 8:24am View
   
don't have any idea.
connect2manas 2-Jul-13 15:19pm View
   
thanks for your answer.
i want a loop.
plz help me.
connect2manas 2-Jul-13 14:56pm View
   
thanks for your answer.

kindly help me to split the below like:

-<documentelement>
-<test>
<c0>manas
<c1>100
<c2>20
<c3>33
<c4>54
<c5>65
<c6>78




- plz try to load this file.
-print the 2 values in a single row
like
manas 100
20 33
54 65
78

plz help me.
connect2manas 28-Jun-13 6:20am View
   
no mahesh,
it is displaying error.
connect2manas 28-Jun-13 3:32am View
   
hi mahesh,
it is not working .same result like alternet row.
connect2manas 28-Jun-13 3:12am View
   
Hi Mahesh,
i have added the following code for the above error.
now no error.
but the result is coming alternet row.
like first row,3rd row,5th row like this.

plz help me.


string sqlText = "select EID,ENAME from EMP FOR XML AUTO";
SqlCommand dataCmd = new SqlCommand(sqlText, Conn);
XmlWriter writer = null;
Conn.Open();
XmlReader dataReader = dataCmd.ExecuteXmlReader();
XmlWriterSettings settings = new XmlWriterSettings()
{
ConformanceLevel = ConformanceLevel.Auto
};
using (writer = XmlWriter.Create(@"D:\Manas\Prodr.xml",settings))
{

while (dataReader.Read())
{
writer.WriteNode(dataReader, true);
}

}
dataReader.Close();
Conn.Close();
connect2manas 28-Jun-13 2:40am View
   
thanks for reply.
but after editing the error is on writer.WriteNode(dataReader, true);
Error is:

Token StartElement in state EndRootElement would result in an invalid XML document. Make sure that the ConformanceLevel setting is set to ConformanceLevel.Fragment or ConformanceLevel.Auto if you want to write an XML fragment.
connect2manas 27-Jun-13 3:20am View
   
i dont know the requirement.but they assigned that task to me.
Aleardy i have done using datatable and adaptor.

plz try to solve this.
connect2manas 25-Jun-13 3:00am View
   
number of tables increases dynamically,so how will i conform that number of tables have to create(T1,T2).
dynamically we have to create the tables.
connect2manas 25-Jun-13 2:47am View
   
Dear Zoltan ,
Thanks for your respons.
but i am getting this type of value from sql analysis service.
so my requirement is to print the teacher name with number of column to display because we can't display all the number of columns(like 100 columns).so i want the above requirement.
kindly help me.
connect2manas 10-Jun-13 8:35am View
   
Plz find the error and reply me.
connect2manas 10-Jun-13 8:35am View
   
i have created the sample .but not displaying any error but not Export to Excel Happening.



using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Microsoft.Office.Interop.Excel;
//using Microsoft.Office.Interop;
using System.Drawing;
using System.IO;
using System.Runtime.InteropServices;

using System.Collections;
using System.Text;
using System.Data;
using System.Reflection;





namespace WebApplication1
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

}
static object useDefault = Type.Missing;
protected void Button1_Click(object sender, EventArgs e)
{

//string workBookName = @"C:\temp\pivottablesample.xlsx";

string connection = @"OLEDB;Provider=SQLOLEDB.1;Integrated Security=SSPI;Data Source=178.10.10.200;Initial Catalog=Employee";

string command = "select * from EMP";

Microsoft.Office.Interop.Excel.Application app = new Microsoft.Office.Interop.Excel.Application();

Microsoft.Office.Interop.Excel.Workbook workbook = (Microsoft.Office.Interop.Excel.Workbook)app.Workbooks.Add(Type.Missing);


Microsoft.Office.Interop.Excel.PivotCache pivotCache = workbook.PivotCaches().Add(Microsoft.Office.Interop.Excel.XlPivotTableSourceType.xlExternal, Type.Missing);

pivotCache.Connection = connection;

pivotCache.MakeConnection();

pivotCache.MaintainConnection = true;

pivotCache.CommandText = command;

Microsoft.Office.Interop.Excel.Worksheet sheet = (Microsoft.Office.Interop.Excel.Worksheet)workbook.ActiveSheet;

pivotCache.CommandType = Microsoft.Office.Interop.Excel.XlCmdType.xlCmdSql;

Microsoft.Office.Interop.Excel.PivotTables pivotTables = (Microsoft.Office.Interop.Excel.PivotTables)sheet.PivotTables(Type.Missing);

Microsoft.Office.Interop.Excel.PivotTable pivotTable = pivotTables.Add(pivotCache, app.ActiveCell, "PivotTable1", Type.Missing, Type.Missing);

pivotTable.SmallGrid = false;
pivotTable.ShowTableStyleRowStripes = true;
pivotTable.TableStyle2 = "PivotStyleLight1";

Microsoft.Office.Interop.Excel.PivotField pageField = (Microsoft.Office.Interop.Excel.PivotField)pivotTable.PivotFields("EName");

pageField.Orientation = Microsoft.Office.Interop.Excel.XlPivotFieldOrientation.xlPageField;

Microsoft.Office.Interop.Excel.PivotField rowField = (Microsoft.Office.Interop.Excel.PivotField)pivotTable.PivotFields("EName");

rowField.Orientation = Microsoft.Office.Interop.Excel.XlPivotFieldOrientation.xlRowField;

pivotTable.AddDataField(pivotTable.PivotFields("ESalary"), "Sum of EmpSalary", Microsoft.Office.Interop.Excel.XlConsolidationFunction.xlSum);


//workbook.SaveAs(workBookName, useDefault, useDefault,
// useDefault, useDefault, useDefault,
// XlSaveAsAccessMode.xlNoChange, useDefault, useDefault,
// useDefault, useDefault, useDefault);


}


}
}
connect2manas 4-Jun-13 7:59am View
   
0


i am creating a Pivot table in excel dynamically using c# coding in Visual studio 2010 enviorenment.In my local system it is creating and working perfectly with calculation when downloading in loacl host.

But when downloading from QA (Quality Analysis) Server the calculation is not coming perfectly but if i will refresh the excel sheet ,then the value coming perfectly.

So what may be the sollution for this issue?