|
gajesh wrote: So that i can read it before main() gets execute.
Nothing happens before main gets executed. Your command line args are available from the Application object, however.
Christian Graus - Microsoft MVP - C++
"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 )
|
|
|
|
|
I think you are talking about console application in c#
if u look at your main method
static void Main(string[] args)
{
//
// TODO: Add code to start application here
//
/// Added next line to print input on console
Console.WriteLine(args[0]);
}
it accepts array of string, this is area where u can pass values
e.g myapplication.exe parameter
Atul kumar
|
|
|
|
|
How Can i read and write to excel sheet
|
|
|
|
|
Take this as a starting point: http://www.bbv.ch/pdf_files/system_event/2005_XMLto%20Excel.pdf
Look for other posts here on CodeProject (there are quite a few).
To sum it up. you can use:
- XSLT (optional with an Excel XML Template file)
- csv files (easiest)
- Interop (search for Excel Interop assemblies)
- use third-party library
Happy programming
Urs
-^-^-^-^-^-
no risk no funk
|
|
|
|
|
Hi!
I've written a program in C# which is running stable for hours. Then, at some moment, I get the Windows Error Message "The program xy has encounterd a problem an has to close". What I did was writeing some information at different time stamps to a file. What is interesting: the file is filled with information AFTER the Error Message and the whole program still keeps running, only the output (multimedia things) is not shown anymore. So in my opinion I have a performance problem.
My question: Does anybody know how to get to the reason for such a Windows error. Can I catch such a Windows error or somehow suppress it?
Is there a possibility to free resources of Windows Form manual?
Kind regards
|
|
|
|
|
Seems like one of your threads exits unexpectedly whereas others continue to run.
First of all check your code, make sure all exceptions get caught and displayed or
logged (not Exception.Message but Exception.ToString()). Add a try-catch construct to
your Main method.
If this does not help, add logging to all your code so you can see which parts keep running,
and which dont; compare parts of the log that you consider normal with the final part, when
the anomaly has occurred.
|
|
|
|
|
IS it not possible to run this application under the debugger and wait for the debugger to catch this?
|
|
|
|
|
Thank you for your answers.
Of course it is possible to work with the debugger or with try/catch but in fact it does not help me because the error is not shown by the debugger. It is a Windows Error Message and that's the great problem.
|
|
|
|
|
Hi guys,
I need to develop a SQL syntax checker in C#, how do I go about doing that, I think there are two approaches, one is with RegEx and other is, I can create some customised SQL Dictionary which can be cross-checked whenever I enter some SQL statement in a text box.
Please help. I need some more ideas for this concept ?
|
|
|
|
|
SQL is simple enough that regex may work. However, not all combinations of SQL statements are valid SQL, so you probably need a more complex parser for it to really work.
Christian Graus - Microsoft MVP - C++
"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 )
|
|
|
|
|
In the good old days we used lex, or flex for this purpose, eventually combined with yacc or bison. Now I don't know. You may google for keywords like parser generator or lexical analysis. No idea how these cooperate with C#
|
|
|
|
|
|
You may want to consider using Antlr[^]. It has grammars for various languages.
|
|
|
|
|
You will need a proper parser for that. Regex with suffice as a tokenizer, but not for grammar parsing. I suggest you go with something like: GPPG[^].
|
|
|
|
|
DataTable mytable = new DataTable();
This is the code. :->
Please elobrate what exactly you are looking for?
|
|
|
|
|
Hi,
If you are looking to create a new data table schema in VC# then below is the code:
DataTable dt = new DataTable("tblName");
dt.Columns.Add("Id", typeof(int));
dt.Columns.Add("Name", typeof(string));
dt.Columns.Add("Age", typeof(int));
dt.AcceptChanges();
If u need any thing specific, let me know.
|
|
|
|
|
He just told you how to do it in C#.
|
|
|
|
|
Hello ,iam fresher
iam developing quiz application in that i have 36 qns.Requirement is upto 34 questions the data stored like int after that means 35 and 36 questions(feedback question )data is stored as a string. Upto 34 questions the datastored in database is int but after that it is not storing.
iIndex for count questions
<pre>
int iIndex = 1;
for(int iCount=0; iCount <iTotal ; iCount++)
{
iIndex = iCount + 1;
SqlCommand cmd=new SqlCommand("insert into tbl_quiz_answer values("+userid+","+ iIndex +",'"+strAns[iCount]+"')");
cmd.Connection = con;
cmd.ExecuteScalar ();
}
con.Close();
srinivas
|
|
|
|
|
srinivassam wrote: Requirement is upto 34 questions the data stored like int after that means 35 and 36 questions(feedback question )data is stored as a string.
What does that mean?
You can't store different datatypes in the same column, if that's what you're trying to do. You have two choices:
1. Use a separate table for storing the feedback.
2. Store all the answers as strings and convert them after you query the database.
Also, do not use string concatenation to build queries. Have a look at SQL injection.
Cheers,
Vıkram.
After all is said and done, much is said and little is done.
|
|
|
|
|
hello.
change the datatype in database for index to either something bigger integer value,
or string, and then perform conversion form string to int and vice versa at front-end.
the first approach is more convenient.
good luck.
|
|
|
|
|
Hi, How you can store string data into an int column, i dint get it. The vice-cersa can happen but not this.
Moreover u shud alwayz make a standard to use parametrised query and not concatenate it or u will introduce a vulnerability to SQL injection attack.
parametrised query is formed like this.
SqlCommand sql_cmd = new SqlCommand("insert into Info values(@id,@name,@age)");
sql_cmd.Parameters.Add("@id", SqlDbType.Int);
sql_cmd.Parameters.Add("@name", SqlDbType.NVarChar);
sql_cmd.Parameters.Add("@age", SqlDbType.Int);
sql_cmd.Parameters["@id"].Value = int.Parse(textBox1.Text);
sql_cmd.Parameters["@name"].Value = "Aman";
sql_cmd.Parameters["@age"].Value = 23;
sql_cmd.ExecuteNonQuery();
try, re-typing the column to varchar if it does not necessarily need to store int data, this should solve the problem or else try parsing your string data to int like int.parse(<string value="">);
|
|
|
|
|
Hi All,
I have one web project which was working fine but after i enable SSL, i could open the project by having the error below:
"The web server reported the following error when attempting to create or open the web project located at the following URL : Http://localhost/download.aspx', HTTP/1.1 403 Access Forbidden"
Another clue that i have is the the cert name that someone created is called "PENEDITEST.pen.apac.com", but my testing server name is "PENEDITEST01", i am not sure whether is it because of this reason that making the error pop up.
Kindly Advice.
Regards,
Lygine
|
|
|
|
|
i send 6 + 1 (6 variables and one starting byte)data from microcontroller to c#.first character is ZERO .and it means next value is first value.another meaning zero will be starting byte.how can i latch zero than save other variables to my array?
|
|
|
|
|
What are these 6 variables you're talking about? Ints of 4 bytes? Ints of 2 bytes? Just bytes?
Cheers,
Vıkram.
After all is said and done, much is said and little is done.
|
|
|
|
|
each of data is just one byte.(between 0-255)
|
|
|
|