|
OK, so your column type has to be some char type, right? Enclose the value in double quotes and you should be good. Unless, of course, the column type of "@#$$%Id%^$#" is something other than a char type??
|
|
|
|
|
Ankitaaguggi wrote: Actually I’ve created SQL Table column name with special character like @#$$%Id%^$#
Bad idea - as you have discovered.
If relevant note that database columns should NOT be used as display values. Thus there should be no reason to include anything but alphanumerics and underscores.
|
|
|
|
|
In a C# desktop 2010 application that I need to write, I will be calling a web service. I have been using batch command prompts to save the output to a text file.
The commands I have been running in the dos window look like the following: cmd1 > file1. Basically the output shows in a dos window and > makes the data displayed in the dos window go to the standard ouput.
My questions are the following:
1. Since I have been using the redirection symbol, the web service must be writing the output to 'standard output' location. However I do not know what the 'standard output' is in a C# 2010 and how to access the 'standard output'. Thus can you tell me what the standard output is and how to access it in a C# 2010 application?
2. Can you tell me how to have information not be displayed in a dos popup window and go to eh location i specify?
|
|
|
|
|
Are you writing a console application?
Then Console.Out is your standard output.
|
|
|
|
|
sc steinhayse wrote: the web service must be writing the output to 'standard output'
Wrong. The web service has no access to the client streams at all. It's your "cmd1" executable that is writing the data to standard output, not the web service.
sc steinhayse wrote: 2. Can you tell me how to have information not be displayed in a dos popup
window and go to eh location i specify?
That depends on your "cmd1" code. All you need to do is grab a path specified on the command line, open the file specified by the path, and write the data to that instead of outputting it to the console. An example of your command line would be:
cmd1 C:\somepath\somefile.txt
If you don't know how to get command line parameters or open a file and write to it, you've got some research to do on the basics of C# and the .NET Framework.
Such as this[^]
and this[^]
|
|
|
|
|
I do not know how to make the C# application use the command line arguments I pass to it.
My command line looks like the following:
Start .\samclt\bin\Debug\samcl.exe encrypted_value https:
I know the application is not using the parameters that appear after the exe by stepping though the code.
Thus can can you tell me how to make the application see the parameters I am trying to pass to it?
|
|
|
|
|
I already showed you in the links at the bottom of my previous post.
|
|
|
|
|
Hello Sir/Mam
I'm trying connect sql server 2000 in windows service with other system on same network.
there are 4 system connected without any problem. But on other 4 system, it is giving error
on connection open while starting windows service. The error is: "the service on local computer started and then stopped some services stop automatically" etc. Same Connection string working in web service
without any error. But giving problem in Window Service. Is there any Configuration setting of that server or sql server 2000. Any help will be highly appreciated.........
|
|
|
|
|
You've asked this in at least one other forum. Please, just use one forum per question.
|
|
|
|
|
can you use connection pool size 1 to 5 etc in your connection string
|
|
|
|
|
In a C# 2010 application that I will be writing, I am trying to decide if I should use regular expression or use a parsing routine to get to the nodes of an xml file I will be working with.
The xml file I receive is not to update my database locally. My response will update the database on the remote site.
Basically I will be obtaining an xml file from a remote web service. When I look at all the results that this web service gives to me, I can uniquely identify patterns in the data that would be appropirate for regular expressions.
However there will be times when I obtain a list of key values that occurs 1 to 500 times. Thus i am wondering if this type of parsing is possible using regular expressions. If so, how would I do that type of parsing with regular expressions?
Also, can you tell me and/or point me to a reference that will tell me how to accomplish this task, using a built in xml parser or code that shows how to parse xml?
|
|
|
|
|
|
|
Hello everyone! I am a new in C# and was trying to access a class from another.
I have created the file Cliente.cs below:
class Cliente
{
public string nome;
public int codigo;
}
Afterwards I have created the file TestaCliente.cs with this code:
class TestaCliente
{
static void Main()
{
Cliente c1 = new Cliente();
c1.nome = "Rafael Consentino";
c1.codigo = 1;
Cliente c2 = new Cliente();
c2.nome = "Jonas Hirata";
c2.codigo = 2;
System.Console.WriteLine(c1.nome);
System.Console.WriteLine(c1.codigo);
System.Console.WriteLine(c2.nome);
System.Console.WriteLine(c2.codigo);
}
}
I have tried to compile the file TestaCliente.cs via command prompt with "csc TestaCliente.cs" and the following error message appears :
Microsoft (R) Visual C# 2010 Compiler version 4.0.30319.1
Copyright (C) Microsoft Corporation. All rights reserved.
TestaCliente.cs(6,4): error CS0246: The type or namespace name 'Cliente' could
not be found (are you missing a using directive or an assembly
reference?)
TestaCliente.cs(6,21): error CS0246: The type or namespace name 'Cliente' could
not be found (are you missing a using directive or an assembly
reference?)
TestaCliente.cs(10,4): error CS0246: The type or namespace name 'Cliente' could
not be found (are you missing a using directive or an assembly
reference?)
TestaCliente.cs(10,21): error CS0246: The type or namespace name 'Cliente' could
not be found (are you missing a using directive or an assembly
reference?)
Obs.:The files are in the same folder.
What am I doing wrong?
Thank you
modified 30-Aug-12 6:32am.
|
|
|
|
|
jamesfrj wrote: What am I doing wrong? This:
jamesfrj wrote: tried to compile .. via command prompt Why would you ever do that? It's just going to cause trouble.
But it's possible, of course. One option is to compile "*.cs" (ie all .cs files in the folder).
For more info, see: Working with the C# 2.0 Command Line Compiler[^]
|
|
|
|
|
|
Few Points:
1. Its better to have namespaces & separate class files.
So, Cliente.cs would contain
namespace TestNs
{
public class Cliente
{
public string nome;
public int codigo;
}
}
and TestaCliente.cs would contain
namespace TestNs
{
class TestaCliente
{
static void Main()
{
Cliente c1 = new Cliente();
c1.nome = "Rafael Consentino";
c1.codigo = 1;
Cliente c2 = new Cliente();
c2.nome = "Jonas Hirata";
c2.codigo = 2;
System.Console.WriteLine(c1.nome);
System.Console.WriteLine(c1.codigo);
System.Console.WriteLine(c2.nome);
System.Console.WriteLine(c2.codigo);
}
}
}
2. Compile them.
csc TestaCliente.cs // this gives error. Because the compiler is not able to identify the reference class file.
Fix for it. Include the other referred files also.
csc TestaCliente.cs Cliente.cs // You need to include as many classes as you refer.
This would create an .exe file.
3. Execute the generated .exe
TestaCliente.exe //this exe will be there in the same folder where you have your class files.
Result:
Rafael Consentino
1
Jonas Hirata
2
Hope I answered the question
|
|
|
|
|
You haven't actually answered the question that was asked. That question was really, why didn't the csc.exe compile the two class files together.
|
|
|
|
|
I have answered it. It was due to namespace. I have placed classes under a namespace and it works.
That's what I commented at last. 'Try this solution and the program should work'.
|
|
|
|
|
A couple of points. The practice of putting multiple classes in one file should be discouraged. It becomes harder and harder to keep separation in your classes if you can't even be bothered to separate your code - never recommend something that shouldn't be done in a professional environment; if you did it working for me, I would make you fix it.
Second, read the title of the thread - it's how to access a class in one file from another file. Not, what hack can I do to get round this.
So, you have not answered the question.
|
|
|
|
|
Few Points:
1. Its better to have namespaces & separate class files.
So, Cliente.cs would contain
namespace TestNs
{
public class Cliente
{
public string nome;
public int codigo;
}
}
and TestaCliente.cs would contain
namespace TestNs
{
class TestaCliente
{
static void Main()
{
Cliente c1 = new Cliente();
c1.nome = "Rafael Consentino";
c1.codigo = 1;
Cliente c2 = new Cliente();
c2.nome = "Jonas Hirata";
c2.codigo = 2;
System.Console.WriteLine(c1.nome);
System.Console.WriteLine(c1.codigo);
System.Console.WriteLine(c2.nome);
System.Console.WriteLine(c2.codigo);
}
}
}
2. Compile them.
csc TestaCliente.cs // this gives error. Because the compiler is not able to identify the reference class file.
Fix for it. Include the other referred files also.
csc TestaCliente.cs Cliente.cs // You need to include as many classes as you refer.
This would create an .exe file.
3. Execute the generated .exe
..\Microsoft Visual Studio 10.0\VC>TestaCliente.exe
Result:
Rafael Consentino
1
Jonas Hirata
2
Hope I answered the question
|
|
|
|
|
You have, but you should reply to the OP here, not me. He doesn't get notifications of replies to me (one minor point, I would remove the Microsoft Visual Studio reference from the path as that could just end up confusing him).
|
|
|
|
|
Thank you, pramodhegde88! It worked perfectly.
|
|
|
|
|
Better use Microsoft Visual Studio. If you don't want to purchase a full version, you can get the "Express" edition for free. Just use the "Build" menu.
|
|
|
|
|
You're right. That happened because I was following a tutorial that does not use Visual Studio.
Thank you
|
|
|
|