|
hellow friends....
i have developed ASP.NET Services and i want to use this services in my VC++ client but i m not getting result although i m able call method correctly using SOAP .. but result is not proper.?
plz tell me where i m making mistake...
//ASP .NET services..
using System;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
[WebService(Namespace = "http:/www.WbService07Name.com/webServices/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class ClsService07 : System.Web.Services.WebService
{
public ClsService07()
{
//Uncomment the following line if using designed components
//InitializeComponent();
}
[WebMethod]
public double DoAdditon(double a, double b)
{
return (a + b);
}
}
///vc++ client
void DisplayAdd()
{
try
{
ISoapSerializerPtr Serializer;
ISoapReaderPtr Reader;
ISoapConnectorPtr Connector;
cout<<"test display:main\n";
// Connect to the service
Connector.CreateInstance(__uuidof(HttpConnector30));
Connector->Property["EndPointURL"] ="http://localhost:2014/WebService07/Service.asmx";
Connector->Connect();
Connector-> Property["SoapAction"] = "http:/www.WbService07Name.com/webServices/DoAdditon";
// Begin message
Connector->BeginMessage();
// Create the SoapSerializer
Serializer.CreateInstance(__uuidof(SoapSerializer30));
// Connect the serializer to the input stream of the connector
Serializer->Init(_variant_t((IUnknown*)Connector->InputStream));
// Build the SOAP Message
Serializer->StartEnvelope("","","");
Serializer->StartBody("");
Serializer->StartElement("DoAdditon",L"http://localhost:2014/WebService07/Service.asmx/","","");
//Serializer->startElement("Add","uri:Calc","","m");
Serializer->StartElement("a","","","");
Serializer->WriteString("5.9");
Serializer->EndElement();
Serializer->StartElement("b","","","");
Serializer->WriteString("10.8");
Serializer->EndElement();
Serializer->EndElement();
Serializer->EndBody();
Serializer->EndEnvelope();
// Send the message to the web service
Connector->EndMessage();
// Let us read the response
HRESULT hr = Reader.CreateInstance(__uuidof(SoapReader30));
// Connect the reader to the output stream of the connector
Reader->Load(_variant_t((IUnknown*)Connector->OutputStream), "");
printf("Answer: %s\n",(const char*)Reader->RpcResult->text);
BSTR br;
Reader->RpcResult->get_text(&br);
cout<
|
|
|
|
|
I have an app.config file that looks like this:
<configuration>
<appsettings file="ClassLibrary1.dll.config">
<appsettings file="ClassLibrary2.dll.config">
This use to work fine in VS 2003, when I migrated to VS 2005 I started getting this error :
" Configuration system failed to initialize"
"Sections must only appear once per config file"
Anyone knows how can I fix this???
Thanks in advance.
|
|
|
|
|
ttohme wrote: " Configuration system failed to initialize"
when I changed the settings available in My.Settings - what I found in my case was that one of the changes I had made had added a StringCollection and it needed a try-catch block to create a new instance the first time around if it didn't exist.
That, plus I had corrupted the user.config file.... when I deleted that it wrote a new one and started working fine.
ttohme wrote: "Sections must only appear once per config file"
To get your code to compile without the warnings, you'll need to replace your call to
System.Configuration.ConfigurationSettings.GetConfig("systems")
with
System.Configuration.ConfigurationManager.GetSection("systems")
This new type lives in the System.Configuration.dll assembly so you'll also need to add a reference to this assembly to your project.
To migrate your v1.1 configuration section handler to v2.0, you'll need to re-write your sectionHandler using the new Configuration system base classes which live in the System.Configuration namespace in the System.Configuration.dll assembly. You'll need to use the following classes: ConfigurationSection, ConfigurationElement and ConfigurationElementCollection.
Here's a pretty good link that blogs how to create your own sectionHandler:
Get it[^]
Regards,
Satips.
|
|
|
|
|
I'm not getting compile errors, I did switch to using ConfigurationManager.
My problem, is that in the old config file I referenced multiple config file in the app.config which means I could access other projects config file setting in the main application, now VS 2005 is complaining the having multiple <appsettings> sections is not allowed.
I need to know how can I modify my config file so it can still reference multiple configuration files.
Thanks
|
|
|
|
|
ttohme wrote: now VS 2005 is complaining the having multiple sections is not allowed.
Yes.
ttohme wrote: I need to know how can I modify my config file so it can still reference multiple configuration files.
Please modify the config file into a single config file and run your application.
Regards,
Satips.
|
|
|
|
|
Thanks for your help I appreciate it.
Can you tell me how to modify my config file into a single config using the config file in my post?
Are you suggesting I copy all the settings from the other config files into the app.config?
Thanks again
|
|
|
|
|
hi , i need to know , how i can add filter to my report
this my code
CrystalDecisions.CrystalReports.Engine.ReportDocument _Rpt;
_Rpt = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
string _path= Application.StartupPath + @"\CrystalReport1.rpt";
this.Text =_path;
_Rpt.Load(_path);
_Rpt.SetDatabaseLogon("sa", "dbadministrator");
System.Diagnostics.Debug.Write(_Rpt.Database.Tables[0].Fields[0].Name); // Name f column
//_Rpt.Rows.DataView.RowFilter = " CustomerId = '00000'";
_Rpt.Load(_path);
//_Rpt.Rows.DataView.RowFilter = "CustomerId = '00000'"; //error
//how i can add filter ? for this report and display it inot crystalreportviewer
this.crystalReportViewer1.ReportSource = _Rpt;
123
|
|
|
|
|
Hi,
I am finding problem in retreiving methods of current class.I don't want to display methods of base class(for ex: Object class).
I am trying with following code
Assembly asm = Assembly.LoadFrom("Hello.exe");
Module[] modules = asm.GetModules();
foreach(Module module in modules)
{
Type[] types = module.GetTypes();
foreach(Type type in types)
{
MethodInfo[] methodInfo = type.GetMethods(BindingFlags.DeclaredOnly);
foreach(MethodInfo mi in methodInfo)
{
Console.WriteLine(mi.name);
}
}
}
|
|
|
|
|
But members of the base ARE members of the current class, by definition ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
You have to at least specify Instance or Static and Public or NonPublic for BindingFlags.
A better way to get the type would be to do: Type type = typeof(MyClass);
|
|
|
|
|
He's iterating all types, so doesn't have a MyClass to look at.
|
|
|
|
|
Well there's always the cumbersome but at least functional option of getting all methods of the class, then getting the methods of its base type and the result will compose of the methods that only appear in the former array.
|
|
|
|
|
goal:
Display all records from a specified table in a Visual Foxpro database in a DGV.
This would not be a problem, except, i only want those rows which have a record id contained by a BindingList<string> TableId
I've tried this:
OledbConnection = new OleDbConnection(connectionString);<br />
OledbCommand = new OleDbCommand(query,connection);<br />
OleDbDataAdapter dataAdapter = new OleDbDataAdapter(query, connection);<br />
<br />
<br />
foreach(string id in TableId)<br />
{<br />
query = "SELECT * FROM " + tableName + " WHERE (" + tableRecordIDColumn + " = '" + id + "') ORDER BY " + tableRecordIDColumn;<br />
command.CommandText = query;<br />
dataAdapter.SelectCommand = command;<br />
dataAdapter.Fill(dataTableFromDb);<br />
}<br />
bindingSource1.DataSource = dataTableFromDb;<br />
dataGridView1.AutoGenerateColumns = true;<br />
dataGridView1.DataSource = bindingSource1;
Allthough this works, it's extremely slow. Especially since my BindingList<string> TableId could contain 20 000 record id's.
Would there be any way to create a dataset with two tables on wich i could excecute a select query wich an inner join on the record id's??
And then use the results as the DataGridView.DataSource?
grts, thx
|
|
|
|
|
sharp source, the problem is: you do to many connections to DB.
I can propose two different solutions:
1) We can include all of this in one SQL:
'OR' version:
<br />
string queryCondition = "";<br />
foreach (string id in TableId)<br />
{<br />
queryCondition += tableRecordIDColumn + " = '" + id + "' OR ";<br />
}<br />
if (queryCondition != "") queryCondition = queryCondition.Remove(queryCondition.Length - 4);<br />
<br />
string query = "SELECT * FROM " + tableName + " WHERE (" + queryCondition + "') ORDER BY " + tableRecordIDColumn;<br />
'In' version:
<br />
string queryCondition = "";<br />
foreach (string id in TableId)<br />
{<br />
queryCondition += "'" + id + "', ";<br />
}<br />
if (queryCondition != "") queryCondition = queryCondition.Remove(queryCondition.Length - 2);<br />
<br />
queryCondition = tableRecordIDColumn + " in (" + queryCondition + ")";<br />
<br />
string query = "SELECT * FROM " + tableName + " WHERE (" + queryCondition + "') ORDER BY " + tableRecordIDColumn;<br />
Remark: You can get an exception like "the query is too long" (because of 2000 entries). You can split them to 100th packs, for example
2) Restricting the logic of data getting (I think it is better)
I think you can find an way to get more simple selecting condition
>>Would there be any way to create a dataset with two tables on wich i could excecute a select query wich an inner join on the record id's??
You can. You can load all data to data. Then you just need to filter the data by using BindingSource class. But this solution is valid when you have to filter data many times per minute.
-- modified at 9:13 Thursday 7th June, 2007
|
|
|
|
|
Your 2 first suggestions i allready tried. And as you say, i need to limit the data getting.
Btw, it's not 2000 but 20 000 rows....
So restricting the logic of data getting.
How would i do that?
So i create a dataset
Add two DataTables
OledbDataAdapter.Fill(DataTable1);
How do i get the BindingList<string> TableId into a table?
And after I have a dataset with the two tables... I gues i can figure that out.
Thx
|
|
|
|
|
>> And as you say, i need to limit the data getting.
Do you want to get a code with splitting by 1000 (for example) Ids?
>> So restricting the logic of data getting.
I meant "restructuring", sorry. So change the logic of the app. To group some ID into groups...
I need to see you task to give you more ideas.
>> How do i get the BindingList TableId into a table?
>>And after I have a dataset with the two tables... I gues i can figure that out.
No, you will have one table with full data in it.
But you will display only necessary information.
To do that you have to bind you table to DataGridView (for example) through BindingSource:
<br />
BindingSource bs = new BindingSource(someDataSet, "SomeMember");<br />
someDataGridView.DataSource = bs;<br />
<br />
<br />
<br />
bs.Filter = "SomeColumn = 'id1' OR SomeColumn = 'id2' OR ..... ";<br />
|
|
|
|
|
how to create dynamic text boxes in c#.net
|
|
|
|
|
|
Textbox txt=new Textbox();
Controls.Add(txt);
txt.show();//it wud display txt at top-left corner of the form
-- modified at 8:11 Thursday 7th June, 2007
Regards
Chintan
www.visharadsoft.com
(Nothing is so purify as KNOWLEDGE)
|
|
|
|
|
There is no reason to call method show.
Any control is shown up on the form at time it has been added to form's component container
P.S. Chintan.Desai, there were many syntax mistakes in you post
|
|
|
|
|
What did you mean: "dynamic text boxes"?
May be you wanted to say how to create text boxes dynamically?
There is the solution:
<br />
private void Form1_Load(object sender, EventArgs e)<br />
{<br />
TextBox myDynamicTextbox = new TextBox();<br />
myDynamicTextbox.Size = new Size(100, 20);<br />
myDynamicTextbox.Location = new System.Drawing.Point(10, 10);<br />
<br />
this.Controls.Add(myDynamicTextbox);<br />
}<br />
|
|
|
|
|
|
The trick is to use a Graphics object obtained from the Image and use that for drawing.
GraphicsPath gp = new GraphicsPath();
Bitmap bmp = new Bitmap(200, 200);
using (Graphics g = Graphics.FromImage(bmp))
{
System.Drawing.Pen pen = System.Drawing.SystemPens.InfoText;
g.DrawPath(pen, gp);
}
|
|
|
|
|
I'm attempting to set up a text input field so that keyboard entry is rejected, but barcode scanner via usb is accepted. How can I programmatically distinguish between the keyboard and a USB based bar code scanner?
|
|
|
|
|
Most of the time, a barcode scanner will supply the data it scans as keystrokes. There's no way to tell the difference between the two.
If the barcode scanner exposes an API, you'd have a much easier time with this since you get the data from the API.
But, disabling keyboard input on this field is a bad idea. What does the user do if the barcode scanner fails??
|
|
|
|