|
the code is very simple.
void proc()
{
...
callreport(1, 'o');
...
}
void callreport(int a, char b)
{
reportJob = new ExReport() //The ExReport is a Crystal Report connected to
// SQL Server 2000 reported by a store
//procedure with one input type char
reportJob.SetParameterValue(0,b); //"The error happened at this line
...
}
That's all.
The code looks simple but it gave me a lot of headache. Thanks
|
|
|
|
|
I have Dundas Gauge for .NET Version 1.6 [for Visual Studio 2005 ] can I use it with .NET 2003
o O º(`'·.,(`'·., ☆,.·''),.·'')º O o°
»·'"`»* *☆ t4ure4n ☆* *«·'"`«
°o O º(,.·''(,.·'' ☆`'·.,)`'·.,)º O o°
|
|
|
|
|
That's probably something you'd have to ask the Dundas people. My guess is no, unless they say "designed for Visual Studio 2005" but didn't actually use any .NET 2 APIs (where VS2005 uses .NET 2 exclusively).
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: I luv teh choco
The apostle Paul, modernly speaking: Epistles of Paul
Judah Himango
|
|
|
|
|
We make versions of the Dundas Gauge product for .Net 1.0, 1.1 and 2.0
So, as long as you install the version for VS 2003 then everything is fine.
If you only received the 2005 version, just email or call your sales rep at Dundas and ask for the VS2003 version as well (you will recieve it at no extra charge).
Troy Marchand
Dundas Software
-- modified at 19:01 Sunday 23rd April, 2006
|
|
|
|
|
Hi Guys!
Is there any tool out there that can be used to convert a Win32 Assembly(dll) to .NET (dll or code).
I would highly appriciate if some1 has an answer!
....Happy Programming....
o O º(`'·.,(`'·., ☆,.·''),.·'')º O o°
»·'"`»* *☆ t4ure4n ☆* *«·'"`«
°o O º(,.·''(,.·'' ☆`'·.,)`'·.,)º O o°
|
|
|
|
|
No, there isn't, and for good reason. One cannot map every single Win32 call into a .NET call. There are usually equivalents or replacements, but certainly no line-for-line equivalence.
|
|
|
|
|
Why won't this code work?
using System;
using System.Windows.Forms;
namespace Practice
{
class Practice
{
public static void Main()
{
// declare and assign a string variable called human
string human;
human = "Walking & talking life";
// declare and assign an int variable called mind
int mind;
mind = 100;
// Print the value of the variables to the console
Console.WriteLine(mind);
Console.WriteLine(human);
}
}
class Continued
{
public static void notMain()
{
MessageBox.Show(human);
MessageBox.Show(mind);
}
}
}
|
|
|
|
|
You did not mention what did not work, but I can guess it is the line:
MessageBox.Show(mind);
unlike Console.WriteLine , MessageBox.Show does not have an overload that takes an int . Try:
MessageBox.Show(mind.ToString());
--------
"I say no to drugs, but they don't listen."
- Marilyn Manson
|
|
|
|
|
The human and mind variables are only visible inside the Main method. To do what you want you need something like this:
class Practice
{
public static string human;
public static int mind;
public static void Main()
{
human = "Walking & talking life";
mind = 100;
}
}
class Continued
{
public static void notMain()
{
MessageBox.Show(Practice.human);
MessageBox.Show(Practice.mind);
}
}
|
|
|
|
|
I'm writing a Windows Forms application which gets data through a Web
Service. I'm trying to use the IIS HTTP 1.1 native compression. In order to
do that I've added the following methods to the proxy class generated by
Visual Studio:
protected override WebRequest GetWebRequest(Uri uri)<br />
{<br />
WebRequest request = base.GetWebRequest(uri);<br />
request.Headers.Add("Accept-Encoding", "gzip, deflate");<br />
return request;<br />
}<br />
<br />
protected override WebResponse GetWebResponse(WebRequest request)<br />
{<br />
HttpWebResponseDecompressed response = new HttpWebResponseDecompressed(request);<br />
return response;<br />
}
The HttpWebResponseDecompressed class receives the compressed response and
decompress it. This is what is happening: if I remove the second line from
the GetWebRequest method (which adds the header), all the 9 requisitions that
I make on the program's initialization have answer. But when the header is
added, only the first 4 requisitions receive answer (the answer is correctly
compressed).
I've enabled the ASP.NET trace (which generates the trace.axd page) so that
I could see the requests received by IIS and the last 5 do not appear. If I
put a breakpoint in the GetWebRequest method, the breakpoint is hit but they
do not reach IIS.
Can anyone tell me what is happening or what can I do?
Thanks
|
|
|
|
|
I am planning to have an application where a menu will be populated dynamically.
Say the menu for the application is as below:
File Test Help
Test1
Test2
By selecting Test1 and Test2 menu I am intending to load a form from the DLL which inherits a base class used in the main application. This class has a Show method to show the child form which is the part of the DLL. I have difficulty passing the main form as parent form. Since I am novice in C# I am trying to follow the standard method as shown below. Is there any other way to achieve it?
CLib.Class1 cls = new CLib.Class1();
<br />
cls.Parent = this;
cls.Show();
In my show method I have code like below:
frmChild frm = new frmChild();<br />
frm.MdiParent=Parent;<br />
frm.Show();
Second thing, lets us say I maintain the Menu Option name and the DLL name in a INI file or XML file. I can populate the menu option dynamically but how I will use the DLL.
Thanks in advance for your kind guidance.
|
|
|
|
|
1. Answering your first question is a bit difficult because you didn't specify where the code resides in. What exactly is this ? I assume you are not in the parent form... What is the error you are getting?
2. Reflection is the way to go:
using System.Reflection;
Assembly assembly = Assembly.LoadFile("C:\\MyDll.dll");
MyBaseClass cls = assembly.CreateInstance("CLib.Class1");
The LoadFile call is only needed once so you could make this on startup once and then just call CreateInstance several times.
|
|
|
|
|
Thank you very much Robert for your quick response.
It seems I could not present my case properly. Here I am trying again.
I have a main application with MDI form with common menu items.
The modules will be available to a user depending upon from which department s/he is from. For example we will have a table to store the user and what module is available to that user
UserID
Module
And another table which contains the module name, and the menu text, that will be shown on the menu and corresponding DLL file name for that module.
Module
Menu Name
DLLFile
These DLL files will have a common method called show(). On the click event of the menu item, the show method basically will load the MDI Child form from the DLL and pass the MDI form reference of the main application as the parent form. With this the menu items on the child form will appear on the main menu of the MDI window.
Hope I made it clear this time.
Thanking you in for your kind help.
|
|
|
|
|
First you would have your parent form:
public class Daddy : Windows.Forms.Form {}
Now that form owns the menu and thus would handle the event for each menu selection. So then your event handler would be something like this: (WARNING: My machine with VS died last night so I'm tinkering with a very bad memory to write this!!!)
// using menuitem.Text append namespace and load it as object child.
MenuItem item = (MenuItem) sender;
// I am not sure of the method below or format but generally....
Assembly assembly = Assembly.LoadFile(path+item.Name);
IBaseChild child = (IBaseChild)assembly.LoadFile( nameSpace + item.Value );
child.MDIParent = this;
child.Show();
-- modified at 17:25 Tuesday 18th April, 2006
|
|
|
|
|
I didn't understand your requirement fully, but assuming that you're trying to load menu,froms and assmblies dynamically (all are unknown to you), can be be done this way:
<br />
public void invokeProcess (string assemblyName, string strModName) <br />
{<br />
Assembly assembly = Assembly.LoadFrom (assemblyName);<br />
<br />
foreach (Type type in assembly.GetTypes ()) <br />
{<br />
if (type.IsClass == true) <br />
{<br />
if (type.FullName != strModName + "." + strModClass) <br />
{<br />
continue;<br />
}<br />
<br />
object ibaseObject = Activator.CreateInstance (type);<br />
<br />
frmDummy frmParent = new frmDummy();<br />
frmParent.MdiParent = this;<br />
<br />
object[] arguments = new object [] {frmParent};<br />
<br />
foreach (MemberInfo mi in type.GetMember(strModEntry))<br />
{<br />
type.InvokeMember (mi.Name.ToString(), <br />
BindingFlags.Default | BindingFlags.InvokeMethod,<br />
null,<br />
ibaseObject,<br />
arguments);<br />
}<br />
}<br />
}<br />
}
hope this will help.
|
|
|
|
|
Thank you vatzcar for your time and kind help . After going through your code, I changed my strategy. Previously I was planning a show method in a class file (in DLL) will take the reference of the MDI form, after that it will show the menu form, in the DLL as child form. Now I am planning to standardise the main form name as frmMenu in all the DLL files. With this the code will be moved to the click event of the menu in the main application. The click event of the menu will call LoadDLL with corresponding assembly name.
private void LoadDLL(string assemblyName)
{
Assembly assembly = Assembly.LoadFrom (assemblyName);
foreach (Type type in assembly.GetTypes ())
{
if (type.IsClass == true)
{
object ibaseObject = null ;
if (type.Name == "frmMenu")
{
ibaseObject = Activator.CreateInstance(type);
Form frmT = (Form)ibaseObject;
frmT.MdiParent = this;
frmT.Show();
}
}
}
}
It is working fine . Is it optimized code?
Thank you.
|
|
|
|
|
I'm glad that somehow i could help you I think it's optimized. And don't thank me, it's the Dev community who deserve 'cause this is what they tought me through the time
|
|
|
|
|
Hi,
I need to call a webservice which needs to use a pool of database connections to read and write data in the DB. But a traditional webservice will create and destroy the connections as it is called and disguarded, but this will mean new connections to the DB all the time.
This has a big hit on performance.
Therefore I need some way of maintainig a pool of connections which is constantly open and available to all instances of the webservice to use(at least one per database) to ensure performance. But how can this be done?
I have done some tests using global.asax, but this does not work.
I also can not find anything on the web.
Can anybody help?
regards
Jason
|
|
|
|
|
Hi,
I need to call a webservice which needs to use a pool of database connections to read and write data in the DB. But a traditional webservice will create and destroy the connections as it is called and disguarded, but this will mean new connections to the DB all the time.
This has a big hit on performance.
Therefore I need some way of maintainig a pool of connections which is constantly open and available to all instances of the webservice to use(at least one per database) to ensure performance. But how can this be done?
I have done some tests using global.asax, but this does not work.
I also can not find anything on the web.
Can anybody help?
regards
Jaso
|
|
|
|
|
Hi,
I need to call a webservice which needs to use a pool of database connections to read and write data in the DB. But a traditional webservice will create and destroy the connections as it is called and disguarded, but this will mean new connections to the DB all the time.
This has a big hit on performance.
Therefore I need some way of maintainig a pool of connections which is constantly open and available to all instances of the webservice to use(at least one per database) to ensure performance. But how can this be done?
I have done some tests using global.asax, but this does not work.
I also can not find anything on the web.
Can anybody help?
regards
Jaso
|
|
|
|
|
Why flood the board with 3 of the same question? If you thought your message didnt post did it occur to you to CHECK before reposting (or hitting submit again and again)
Connections to databases like MSSQLServer are pooled by the provider, trying to re-invent connection pooling will lead to WORSE performance, I promise!
-- modified at 11:08 Tuesday 18th April, 2006
|
|
|
|
|
Hi,
Two things;
1. I did check and it did not appear, plus I got a strange error message
2. I am not trying to reinvest connection pooling, look at the question in detail.
If you call a webservice then it will initiate a new instance, including a new instance of the pooling because there is nothing already in memory and therefore nothing to use. Therefore there is no benefit to pooling in this case.
I want to share database connections between istances of the webservice, not within the websevice itself.
Jason
|
|
|
|
|
Ok, I wasn't sure what board to put this so I am shooting here first as it is a c# code question:
I have the following XML Data that is returned from a 3rd party API. The resulting data is stored as a string and loaded into the XML dom as follows:
// s_invoices contains the XML
string s_invoices;
XmlDocument doc = new XmlDocument();
doc.InnerXml = s_invoices;
XmlElement root = doc.DocumentElement;
The XML itself looks like the following (sample):
<?xml version="1.0" encoding="UTF-8"?>
<Order_Invoice_Outgoing_Array_Element>
<Order_Invoice_Outgoing_Element>
<interface_transaction>18399</interface_transaction>
<transaction>18399</transaction>
<order_Invoice_Header>
<vendor>P00621</vendor>
<invoice>90951282</invoice>
<currency>USD</currency>
<invoice_Category>ORDER</invoice_Category>
<invoice_Date>2003-08-18T00:00:00.000-04:00</invoice_Date>
<invoice_Due_Date>2003-0818T00:00:00.00004:00</invoice_Due_Date>
<terms>NET30</terms>
<invoice_Amount_Total>6260</invoice_Amount_Total>
<status>CLOSED</status>
<currency_Exchange_Rate>1</currency_Exchange_Rate>
<order_Type_Optional>PO</order_Type_Optional>
<order_Number_Optional>40845</order_Number_Optional>
<pay_Indicator>AP</pay_Indicator>
<original_Invoice_Amount>0</original_Invoice_Amount>
<GL_Account>
<GL_Company>443120</GL_Company>
<GL_Expenditure>809</GL_Expenditure>
<GL>0</GL>
<GL_Cost_Center>0</GL_Cost_Center>
<GL_Description>REPAIR ORDERS</GL_Description>
<GL_Category>ALL</GL_Category>
<modified_By>GLACCOUNT</modified_By>
</GL_Account>
<voucher>78086</voucher>
<created_By>TGREEN</created_By>
<created_Date>2003-10-31T00:00:00.000-05:00</created_Date>
<modified_By>PFAPHSTN</modified_By>
<modified_Date>2006-03-19T00:00:00.000-05:00</modified_Date>
<line_Sum>6260</line_Sum>
<AP_System_Received_Flag>false</AP_System_Received_Flag>
<paid_Flag>true</paid_Flag>
<interface_Batch>14975</interface_Batch>
</order_Invoice_Header>
<order_Invoice_Lines>
<order_Invoice_Line>
<order_Type>PO</order_Type>
<order_Line>7</order_Line>
<order_Number>40845</order_Number>
<invoice_Category>ORDER</invoice_Category>
<invoice_Date>2003-08-18T00:00:00.000-04:00</invoice_Date>
<invoice_Amount>6260</invoice_Amount>
<invoiced_Qty>1</invoiced_Qty>
<GL_Account>
<GL_Company>443120</GL_Company>
<GL_Expenditure>809</GL_Expenditure>
<GL>0</GL>
<GL_Cost_Center>0</GL_Cost_Center>
<GL_Description>REPAIR ORDERS</GL_Description>
<GL_Category>ALL</GL_Category>
<modified_By>GLACCOUNT</modified_By>
</GL_Account>
<status>CLOSED</status>
<assigned_To>VHAINES</assigned_To>
<credit_Memo>78086</credit_Memo>
<credit_Memo_Cost>0</credit_Memo_Cost>
<original_Invoice_Amount>0</original_Invoice_Amount>
<created_By>TGREEN</created_By>
<created_Date>2003-10-31T00:00:00.000-05:00</created_Date>
<modified_By>PFAPHSHD</modified_By>
<modified_Date>2006-03-19T08:39:39.000-05:00</modified_Date>
<line_Amount>6260</line_Amount>
</order_Invoice_Line>
</order_Invoice_Lines>
</Order_Invoice_Outgoing_Element>
</Order_Invoice_Outgoing_Array_Element>
So basically it is a very convoluted XML string. Now what I want to do is populate the XML into a form but am having problems finding what I am looking for.
I am currently using the following:
Console.WriteLine(" The terface_transaction : {0}", root.GetAttribute("//Order_Invoice_Outgoing_Array_Element/Order_Invoice_Outgoing_Element/interface_transaction"));
To try to write out just the interface transaction portion of the XML but alas it is not working. I am thinking it is because maybe GetAttribute is set to start at root and somehow my pathing is wrong, any ideas?
-- modified at 10:38 Tuesday 18th April, 2006
|
|
|
|
|
Hi,
hard to read that XML stuff without proper formmating but I think the caus is that interface_transaction isn't an attribute - it's a node. Although I don't know the error message (you should have specified it instead of 'not wokring') I assume it should be something like:
root.SelectSingleNode("Order_Invoice_Outgoing_Array_Element/"
+ "Order_Invoice_Outgoing_Element/interface_transaction").Value
This should give you the text. You could also split the query to further verify where the problem lies:
XmlNode firstNode = root.SelectSingleNode("Order_Invoice_Outgoing_Array_Element");
XmlNode secondNode = firstNode.SelectSingleNode("Order_Invoice_Outgoing_Element");
XmlNode thirdNode = secondNode.SelectSingleNode("interface_transaction");
Console.WriteLine(thirdNode.Value);
This way you could step through with the debugger and identify where exactly something is not found.
|
|
|
|
|
One approach you could investigate is as follows:
If the xml is well-formed, and the xml can be defined by a schema, and you have enough time to quickly code a class and a test program, then do this:
The xml that is passed to you would be passed into a stream (search for putting a string to a stream for implementation details)
next create a class that represents the data (you may have to work backwards....create the class, serialize it, then see if it matches the xml)
Next take the stream and feed it into an XmlSerializer to turn it into a C# object. From that point forward you are working with an object instead of screwing around with the DOM.
-- modified at 16:21 Tuesday 18th April, 2006
|
|
|
|