|
Do you really need to use the 64 bit version of ODP.NET on the server?
|
|
|
|
|
Unfortunately yes, sysadmin installs these items and it will take some time to change.
Besides, I would prefer a 64bit development machine instead
V.
|
|
|
|
|
VS is bit weird with these - changing it in one place sometimes updates the other places, sometimes not. Specifically, changing the "active solution platform" changes everything else, but changes made in other places do not propagate (I suppose it can sometimes be useful to set the target differently for different projects in a solution, but usually it's a Bad Thing)
Were ALL of those settings set to "Any CPU", and if not, does it work if you make it so?
|
|
|
|
|
Hello,
Thanks for your reply. Any CPU was were it was on originally, but that's where the ODP.Net component started to mess things up when installed on the (x64) server. It was solved when compiling specifically against 64 bit, but that resulted in our local development to be messed up.
V.
|
|
|
|
|
Strange. I don't think I can be of much help them then. Maybe you can convert the dev machines to 64bit?
modified 15-Nov-11 6:39am.
|
|
|
|
|
harold aptroot wrote: I don't think I can be of much help them
No worries, you tried.
harold aptroot wrote: Maybe you can convert the dev machines to 64bit?
Long story, don't get me started .
anyway, I appreciate the help.
V.
|
|
|
|
|
I have the following code after this execution i have to navigate to other Page can any one help me out..
Response.ContentType = "application/pdf";
Response.AddHeader("content-disposition", "attachment;filename=Export.pdf");
Response.Cache.SetCacheability(HttpCacheability.NoCache);
StringWriter sw = new StringWriter();
HtmlTextWriter hw = new HtmlTextWriter(sw);
HtmlForm frm = new HtmlForm();
gv.Parent.Controls.Add(frm);
frm.Attributes["runat"] = "server";
frm.Controls.Add(gv);
frm.RenderControl(hw);
StringReader sr = new StringReader(sw.ToString());
Document pdfDoc = new Document(PageSize.A4, 10f, 10f, 10f, 0f);
HTMLWorker htmlparser = new HTMLWorker(pdfDoc);
PdfWriter.GetInstance(pdfDoc, Response.OutputStream);
pdfDoc.Open();
htmlparser.Parse(sr);
pdfDoc.Close();
Response.Write(pdfDoc);
Response.End();
Response.Redirect()// Not working
Server.Transfer()// Not working
Please any one help me to navigate to other page here ??
Thanks in Advance.
|
|
|
|
|
you are terminating response at this line
pravin_mun wrote: Response.End(); comment out this line,
Response.Redirect("URL") should work then.
Regards
modified 15-Nov-11 1:37am.
|
|
|
|
|
No Luck..!! Tried with the same.. Getting this exception..!("Cannot redirect after HTTP headers have been sent.")
|
|
|
|
|
First of all, I don't understand why you want to redirect after sending anything to browser. Didn't check that in VS, but believe the problem is that you are modifying response, and then doing Response.Redirect. Try removing lines:
<br />
Response.ContentType = "application/pdf"; <br />
Response.AddHeader("content-disposition", "attachment;filename=Export.pdf");<br />
Response.Cache.SetCacheability(HttpCacheability.NoCache);<br />
<br />
Response.Write(pdfDoc);<br />
Response.End();<br />
And check if Response.Redirect works.
Don't forget to rate answer, that helped you. It will allow other people find their answers faster.
|
|
|
|
|
I have enclosed a short snippet of code of my attempt to pass a Generic list to a new form. I can't get it done. Any help would be great:
Code from Main form
public List<iattachmentlist> iattachmentagents = new List<iattachmentlist>();
public class iattachmentlist
{
private string _title;
private stream _attachment;
public string TITLE { get { return _title; } set { _title = value; } }
public stream ATTACHMENT { get { return _attachment; } set { _attachment = value; } }
public iattachmentlist(string xtitle, object xattachment)
{
_title = xtitle;
_attachment = xattachment;
}
}
private void attachmentsbutton_Click(object sender, EventArgs e)
{
emailattachment attachform = new emailattachment();
attachform.pgsource = pgsource;
attachform.id = id;
attachform.iattachmentagents = ?????????;
attachform.ShowDialog();
attachform.Close();
}
How do I set up attachform?
Kendall
|
|
|
|
|
I can't provide specific help as you didn't include the relevant code snippet, where iattachmentagents gets defined. It is also unclear whether you are using nested classes, or in what type the first line is actually defined.
What I can tell you is this:
1. there is nothing special about passing generic lists; in a statement such as a = b; a and b could both be an int, or a string, or a list of some type, it doesn't matter, as long as both sides agree.
2. if a class property needs to have a specific type, just set it, as in:
class SomeClass {
private List<string> myListOfStrings;
public List<string> MyListOfStrings {
get { return myListOfStrings; }
set { myListOfStrings = value; }
}
}
3. I suggest you switch to standard formatting, clearer identifier names, and standard casing. At first glance your code does not even look like C#. If you're new to C#, maybe an introductory book could get you started on the right track.
|
|
|
|
|
Sorry for the format and casing. I hope the code snippet below will help define my problem.
Main form:
namespace Vetnet
{
public partial class emailform : Form
{
public string pgsource;
public string cpass
{ set { pgsource = value; } }
public string id;
public string passid
{
set {id=value;}
get {return id;}
}
public List<iattachmentlist> iattachmentagents = new List<iattachmentlist>();
public emailform()
{
InitializeComponent();
}
public class iattachmentlist
{
private string _title;
private stream _attachment;
public string TITLE { get { return _title; } set { _title = value; } }
public stream ATTACHMENT { get { return _attachment; } set { _attachment = value; } }
public iattachmentlist(string xtitle, object xattachment)
{
_title = xtitle;
_attachment = xattachment;
}
}
private void attachmentsbutton_Click(object sender, EventArgs e)
{
emailattachment attachform = new emailattachment();
attachform.pgsource = pgsource;
attachform.id = id;
attachform.iattachmentagents = iattachmentagents;
attachform.ShowDialog();
attachform.Close();
}
public class emailattachment : Form
{
public string pgsource;
public string cpass
{ set { pgsource = value; } }
public string id;
public string passid
{
set { id = value; }
get { return id; }
}
public string displaymode;
public List<iattachmentlist> iattachmentagents = new List<iattachmentlist>();
public List<iattachmentlist> pass
{
public set { iattachmentagents = value; }
public get { return iattachmentagents; }
}
public emailattachment()
{
InitializeComponent();
}
Please don't get hung up on my poor formating and casing.
Kendall
|
|
|
|
|
This is horrible code simply by (A) your extremely poor choice of identifier names and (B) you making everything public. This causes total confusion to you and everyone else.
Examples:
1. class iattachmentlist does not represent a list, it seems to represent an attachment, which later on might or might not go into a list. Do you call your house a homecity just because it is your home and part of the city you live in, I think not.
The right name would be: class Attachment , notice an existing word, explaining exactly what it is, starting with an uppercase as it is public, and absolutely not beginning with "I" as it isn't an interface.
2. class emailattachment : Form is equally bad, the class does not represent an attachment, it probably is a Form going to be used to do something to an attachment. So maybe it should be class EditAttachmentForm .
3. inside class emailattachment you have both a public member iattachmentagents and a public property pass using said member; that does not make sense at all.
I am not going to spend more time here, it is up to you to untangle this mess. Sorry.
|
|
|
|
|
As has been mentioned, the naming and casing makes it very hard to figure out what you are doing.
where yuo say 'it screws up here I think' it is just trying to instantiate the generic list - not pass it over to another form - so I cant see why you think it is screwing up - what is / isn't happening?
I quickly copy/pasted your code into a new solution and got compilation errors, and about gave up there.
I would firstly suggest you remove the public class iattachmentlist into its own source file.
then I would rename things as has been suggested, get a clean compilation and try again - and post again if its not working still.
|
|
|
|
|
What version of .NET are you compiling to ?
Assuming you can compile this without error:
1. set a break-point on the first line in 'attachmentsbutton_Click
2. F11 single-step through the code until you encounter an error, and then report the specific error here
3. if it breaks before even reaching 'attachmentsbutton_Click, then set a break-point in the 'InitializeComponent(); if the 'eMailForm constructor, and single-step from there
If this doesn't compile: what's the error report(s) from the compiler.
And, as _Maxxx_ commented on, if you are passing a generic List in to this new Form you are creating why do you need to instantiate it in the new 'emailAtttachment instance ?
good luck, Bill
"I have always wished for my computer to be as easy to use as my telephone; my wish has come true because I can no longer figure out how to use my telephone." Bjarne Stroustrop circa 1990
|
|
|
|
|
I would like to thank _Maxxx_ and Bill for taking the time to look at the code. AS _Maxxx_ recommended I eliminated the instance of 'emailAttachemnt' in the second form. Still will not compile.
private void attachmentsbutton_Click(object sender, EventArgs e)
{
emailattachment attachform = new emailattachment();
attachform.pgsource = pgsource;
attachform.id = id;
attachform.iattachmentagents = iattachmentagents;
attachform.ShowDialog();
attachform.Close();
}
Does this help?
also-> Net 3.5, Visual studio 8
Kendall
|
|
|
|
|
The error message does tell you what the problem is, unfortunately it's not an easy one to see because you have the same list name in two classes. Basically, it's saying that you are trying to assign List<Vetnet.emailform.iattachmentlist> to a List<Vetnet.emailattachment.iattachmentlist> . You cannot assign a list of one type to a list of others like this without there being some form of conversion.
|
|
|
|
|
convert to an array? send it and then convert it back to a list? Any way to just access the list in form1 from form2?
Kendall
|
|
|
|
|
I have this method:
public static List<PartModel> QueryInventoryParts(List<<SearchItemModel>> SearchTerms, int ProducId = 0)
{
using (SparesDataContext context = getDataContext())
{
List<<PartModel>> retVal = new List<<PartModel>>();
foreach (SearchItemModel searchModel in SearchTerms)
{
List<<PartModel>> results = (from pp in context.mmlProductsParts
join pa in context.tblParts on pp.PartId equals pa.PartId
where pa.PartNumber.Contains(searchModel.SearchTerm) ||
pa.Keyword.Contains(searchModel.SearchTerm)
select new PartModel
{
PartId = pa.PartId,
Category = GetCategory(pa.CategoryId),
PartNumber = pa.PartNumber,
Keywords = pa.Keyword,
PartDescription = pa.Description,
Price = pa.Price.Value,
Ratio = pa.Ratio.Value,
Tribal = pa.Tribal
}).ToList();
foreach (var result in results)
{
retVal.Add(result);
}
}
return retVal;
}
}
If the ProductId is passed in, then I was to add "&& pp.ProductId = ProductId" to the WHERE clause,
however, if Zero is passed in, I want to return all products.
I'm not sure of the syntax on this. Can someone show me?
Thanks
Everything makes sense in someone's mind
|
|
|
|
|
where (...) && ((pp.ProductId == ProductId) || (ProductId == 0))
Or am I missing something?
|
|
|
|
|
Hi, probably not the best solution but off the top of my head i can think of 2 methods.
1. Use a switch on ProductID - case 0: --> do query to return all
default: --> do other query to return specifics matching ProductId
2.
List<< PartModel>> results = ((ProductId != 0) ? (from pp in context.mmlProductsParts
join pa in context.tblParts on pp.PartId equals pa.PartId
where pa.PartNumber.Contains(searchModel.SearchTerm) ||
pa.Keyword.Contains(searchModel.SearchTerm)
&& pp.ProductId == ProductId
select new PartModel
{
PartId = pa.PartId,
Category = GetCategory(pa.CategoryId),
PartNumber = pa.PartNumber,
Keywords = pa.Keyword,
PartDescription = pa.Description,
Price = pa.Price.Value,
Ratio = pa.Ratio.Value,
Tribal = pa.Tribal
}).ToList()
: (from pp in context.mmlProductsParts
join pa in context.tblParts on pp.PartId equals pa.PartId
where pa.PartNumber.Contains(searchModel.SearchTerm) ||
pa.Keyword.Contains(searchModel.SearchTerm)
select new PartModel
{
PartId = pa.PartId,
Category = GetCategory(pa.CategoryId),
PartNumber = pa.PartNumber,
Keywords = pa.Keyword,
PartDescription = pa.Description,
Price = pa.Price.Value,
Ratio = pa.Ratio.Value,
Tribal = pa.Tribal
}).ToList());
Hope that helps
|
|
|
|
|
What's the right way to do this:
var temp = (from pr in context.tblProducts
join pp in context.mmlProductsParts on pr.ProductId equals pp.ProductId
join pa in context.tblParts on pp.PartId equals pa.PartId
where pr.ProductSeries.Contains(searchModel.SearchTerm) ||
pr.ProductNumber.Contains(searchModel.SearchTerm)
select new ProductModel
{
ProductId = pr.ProductId,
ProductNumber = pr.ProductNumber,
ProductSeries = pr.ProductSeries,
Parts = (new PartModel
{
PartId = pa.PartId,
Category = GetCategory(pa.CategoryId),
PartNumber = pa.PartNumber,
Keywords = pa.Keyword,
PartDescription = pa.Description,
Price = pa.Price.Value,
Ratio = pa.Ratio.Value,
Tribal = pa.Tribal
}).ToList())
}).ToList();
The property Parts on the Product model is of type List<partmodel>. The compiler is complaining telling me that PartModel does not contain a definition fo "ToList".
What's the right way to do this??
Everything makes sense in someone's mind
|
|
|
|
|
While I can't understand the depths of this code, I think I can ask an obvious question:
If 'Parts is a list, I assume a generic list of 'PartModel, then why, when you create a new 'PartModel, and assign values to its inner fields, are you not adding it to the 'Parts list ?
"I have always wished for my computer to be as easy to use as my telephone; my wish has come true because I can no longer figure out how to use my telephone." Bjarne Stroustrop circa 1990
|
|
|
|
|
Hi - I just converted an ASP.Net web app from 2.0 to 4.0 and the XslTransform code that I inherited no longer works in 4.0. I'm told I need to change the code to use XslCompiledTransform. Fine - but I can't figure out how to get XslCompiledTransform to do exactly what I need it to do. I have an XSL file in my project. I do not have an XML or HTML file. The old code read as follows:
using (DataSet data = DataGateway.getAbsence(TripNum))
{
data.DataSetName = "Absence";
data.Tables[0].TableName = "Employee";
XmlDataDocument xmldoc = new XmlDataDocument(Data);
XslTransform xslt = new XslTransform;
string xsltfile = "myfile.xsl";
xslt.Load(xsltfile);
TextWriter writer = new StringWriter();
xslt.Transform(xmldoc, null, writer, null);
MailMessage mail = new MailMessage();
mail.Body = writer.ToString();
mail.From = "me";
mail.To = "you";
}
I've tried to rewrite this by substituting and XsltCompiledTransform object for the XslTransform object, and an XmlWriter object for the TextWriter object, but the xslt.Transform line complains about my using an XmlDataDocument as input. It suggests an XmlReader instead, but I don't know how to pass the data from my DataSet into an XmlReader. Or perhaps XslCompiledTransform is not the way to go Does anyone know?
Thanks!
|
|
|
|
|