|
Hi,
I want to convert excel file to pdf programatically how can this be done
|
|
|
|
|
Try this[^]
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
i want to use it in web application any free dll available
|
|
|
|
|
Good Day All
I have the Following Code in my DAL
public SqlDataReader Get_Staff_Cycles_internal(String DB)
{
SqlDataReader rd = null;
strcon = GetConnectionString(DB);
con = new SqlConnection(strcon);
cmdselect = new SqlCommand();
cmdselect.CommandType = CommandType.StoredProcedure;
cmdselect.CommandText = "[dbo].[sp_Get_Staff_Cycles_internal]";
cmdselect.CommandTimeout = 0;
cmdselect.Connection = con;
try
{
con.Open();
rd = cmdselect.ExecuteReader(CommandBehavior.CloseConnection);
}
catch (SqlException)
{
throw;
}
finally
{
if (con != null)
{
con.Close();
}
}
return rd;
}
and Am using this code Like this In BLL
public SqlDataReader Get_Staff_Cycles(int ACTIVITY_ID, String DB)
{
DAL.DAL obj = new DAL.DAL();
SqlDataReader rd = null;
try
{
obj.Get_Staff_Cycles(ACTIVITY_ID, DB);
rd = obj.Get_Staff_Cycles_internal(DB);
}
catch (SqlException)
{
throw;
}
finally
{
obj = null;
}
return rd;
}
And am Calling it like this in PL(Presentation Layer)
private void Bind_Grid_For_Staff()
{
SqlDataReader rd = null;
BLL.BLL obj = new BLL.BLL();
try
{
if (Convert.ToString(Session["Selected_ID_Bind"]).Length > 6)
{
String Activityid = Convert.ToString(Session["Selected_ID_Bind"]);
if (Activityid != null || Activityid != "")
{
ArrayList Final_String = (ArrayList)Fixed_String_Multi(Activityid);
for (int i = 0; i < Final_String.Count; i++)
{
rd = obj.Get_Staff_Cycles(Convert.ToInt32(Final_String[i]), Convert.ToString(Session["ActiveDatabase"]));
}
if (rd != null)
{
while (rd.Read())
{
Gridstaff.DataSourceID = null;
Gridstaff.DataSource = rd;
Gridstaff.DataBind();
}
}
}
else
{
lblGridStaff.Text = "Could not Bind StaffGrid";
lblGridStaff.ForeColor = System.Drawing.Color.Red;
}
}
else
{
if (Convert.ToString(Session["Selected_ID_Bind"]) != null)
{
String Activityid = Convert.ToString(Session["Selected_ID_Bind"]);
if (Activityid != null || Activityid != "")
{
ArrayList Final_String = (Fixed_String(Activityid));
for (int d = 0; d < Final_String.Count; d++)
{
rd = obj.Get_Staff_Cycles(Convert.ToInt32(Final_String[d]), Convert.ToString(Session["ActiveDatabase"]));
}
if (rd != null)
{
Gridstaff.DataSource = rd;
Gridstaff.DataBind();
rd.Close();
}
}
else
{
lblGridStaff.Text = "Could not Bind StaffGrid";
lblGridStaff.ForeColor = System.Drawing.Color.Red;
}
}
else
{
Response.Redirect("SubjectStaff.aspx", false);
}
}
}
catch (ApplicationException e)
{
lblStatus.Text = e.Message.ToString();
}
}
i get an Error
Invalid attempt to call MetaData when reader is closed.
and its Poiting to the part that Binds the gridview here
Gridstaff.DataBind();
Thank you
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.tiyaneProperties.co.za
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
Never, ever, ever try to bind an open datareader to a form, while the data reader is open the connection is locked.
Change from using datareader to datatable (uses a datareader under the hood) and it should all fall into place
Vuyiswa Maseko wrote: rd = cmdselect.ExecuteReader(CommandBehavior.CloseConnection);
I use this to return a table
SqlCommand oCmd = new SqlCommand();<br />
SqlDataAdapter oDA = new SqlDataAdapter();<br />
DataSet oDS = new DataSet();<br />
<br />
oCmd = CreateCommand(sProcedureName, arParam);<br />
<br />
oDA.SelectCommand = oCmd;<br />
oDA.Fill(oDS);<br />
<br />
<br />
mvTimeOut = _TimeOut;<br />
return oDS.Tables[0];<br />
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Thanks Mycroft
Am trying to avoid using Datatable because of Performance. That is why i wanted to use a datareader.
Thanks
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.tiyaneProperties.co.za
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
You must have an extroadinary amount of throughput to be able to detect the performance difference between reader and table or is it theoretical peformance difference.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Its Cool, I used a Datatable
Thanks
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.tiyaneProperties.co.za
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
Hi all,
I am using windows application in C#.
Sometimes i am getting the below exception,
{"The process cannot access the file 'C:\\Documents and Settings\\suq31399\\Local Settings\\Temp\\IHSPublisher\\d954cc77-2722-41c3-9efa-3b20e11003cf.txt'
because it is being used by another process."}
[System.IO.IOException]: {"The process cannot access the file
'C:\\Documents and Settings\\suq31399\\Local Settings\\Temp\\IHSPublisher\\d954cc77-2722-41c3-9efa-3b20e11003cf.txt'
because it is being used by another process."}
Data: {System.Collections.ListDictionaryInternal}
HelpLink: null
InnerException: null
Message: "The process cannot access the file
'C:\\Documents and Settings\\suq31399\\Local Settings\\Temp\\IHSPublisher\\d954cc77-2722-41c3-9efa-3b20e11003cf.txt'
because it is being used by another process."
Source: "IHSPublisher"
StackTrace: "
at IHSPublisher.Publisher.p_GetDocumentByFileIdentifierCompleted(Object sender, GetDocumentByFileIdentifierCompletedEventArgs e) in D:\\Ashok\\Projects\\PCN2.3\\newpublisher_080808\\IHSPublisher\\Publisher.cs:line 319\r\n
at IHSPublisher.PCNAlert.Service.Publishing.Publisher.OnGetDocumentByFileIdentifierOperationCompleted(Object arg) in D:\\Ashok\\Projects\\PCN2.3\\newpublisher_080808\\IHSPublisher\\Web References\\PCNAlert.Service.Publishing\\Reference.cs:line 486"
TargetSite: {Void p_GetDocumentByFileIdentifierCompleted(System.Object, IHSPublisher.PCNAlert.Service.Publishing.GetDocumentByFileIdentifierCompletedEventArgs)}
Can anyone help me to solve this exception.
Thanks,
Ashok
|
|
|
|
|
So presumably another process is writing the file to the location, I am assuming you are trying to read it while some other process is still writing. Build in a delay for x seconds the first time you see the file and try again.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi,
I get the same error. I'm using a FileInfo object with a file name passed to the constructor upon creating the FileInfo object. I check if the file exist and if so I delete it and recreat it. Al works fine first time but when I click on the button again to do the same functionality over again I get same error mentioned. The is NO close method on the FileInfo object nor Dispose. I tried the Refresh() in desprate attemps but still error. Please see a snipplet below:
private void button2_Click(object sender, EventArgs e)
{
FileInfo fileInfo = new FileInfo(label2.Text + ".TMP");
if (fileInfo.Exists)
{
fileInfo.Delete();
}
fileInfo.Create();
int y = 0;
}
|
|
|
|
|
Hi Guys,
Mine was a dumbass developer faullt...well... din't realy knew once you create the file the creat method returns a stream so yea just changed my line of code abit
FileStream stream = fileInfo.Create();
stream.Close()
Hope your problem is as simple as this...
|
|
|
|
|
string FilePath = "C:\\Users\\VijayaShyam\\Documents\\Visual Studio 2008\\Projects\\UdayPowerSystems\\UdayPowerSystems\\PrintPage.txt";
System.Security.AccessControl.FileSecurity FS = new System.Security.AccessControl.FileSecurity("PrintFile.txt",System.Security.AccessControl.AccessControlSections.Access);
// string temp = "D:"; //System.IO.Path.GetTempPath();
FileStream fStream = File.Open(FilePath,FileMode.OpenOrCreate,FileAccess.ReadWrite,FileShare.ReadWrite);
fStream.SetAccessControl(FS);
// System.Security.AccessControl.DirectorySecurity dSec = Directory.GetAccessControl(fStream.Name);
fStream.GetAccessControl();
/// Which OS Your using
|
|
|
|
|
Hi guys i am getting my double values like:
3.1489789798E-6
Now i want this values in exact value lie:
0.003 some thing like this with out exponential...,
How its possible i searched in google i didnt get idea,
pla help me out in this,
Thanks & Regards,
Member 3879881,
please don't forget to vote on the post
|
|
|
|
|
|
Can we Update records in the table using SqlBulkCopy
|
|
|
|
|
No
Unless you bulkcopy into another table and execute a proc to do the update
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
yes u can do, bring all data into DataTabel...
|
|
|
|
|
Hello!
I know how to do extension methods and I'm pretty sure I could teach my cat to do them too, but is there a way to somehow have one external method, and use it in several different projects simply by referencing the file it is contained in? Would this be done in a class file ir DLL file? I'm pretty new to this stuff, and would appreciate any suggestions. Thanks for readin'.
Regards,
Jase
private void Yay()
{
DirectoryInfo Di = new DirectoryInfo("J:\\");
FileInfo[] Files = Di.GetFiles("*.*");
foreach( FileInfo file in Files )
{
// Do something constructive.
}
}
|
|
|
|
|
Either way could work, to be honest. It's up to you whether you want the overhead of an extra DLL, or you're happy having the code included as a link.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Thank you Pete.
foreach( inch on Jason )
{
Girlfriend.IsHappier();
}
|
|
|
|
|
Hi ,
i made a connection string in app.config file. and i want to use this into my .cs file while creating connection object...
objSqlConnection1.ConnectionString = ?
please post the solution..
|
|
|
|
|
if your connection string is like this
add name="conn1" connectionString="string1"
ur access will be like this.
string conn = ConfigurationManager.ConnectionStrings[conn1].ConnectionString;
|
|
|
|
|
thanks !
but it gives an error "ConfigurationManager" does not exist into current context
|
|
|
|
|
add a reference in ur class file.
using System.Configuration;
|
|
|
|