473,472 Members | 2,176 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Invalid expression term 'out'

14 New Member
Hi, I'm a little bit new in this area and I have this error
Can someone tell me what is this mean? -
Invalid expression term 'out' and
Identifier expected; 'out' is a keyword

Expand|Select|Wrap|Line Numbers
  1. public static void userDell(string msi,String filename, String DB_CONN_STRING)
  2.         {
  3.             String temp_msisdn = "+" + msi;
  4.             bool ima = DatabaseConnection.checkExist(temp_msi);
  5.             bool result;
  6.             if (ima) 
  7.             {
  8.                 result = DatabaseConnection.deleteRoute(temp_msi);
  9.             }
  10.             System.out.println ("Delete Route " + temp_msi);
  11.             WriteLog.writeLog(filename + "|OK|DELETE|" + temp_msi + "||" + "route deleted||\n", "logs", "1.log");
  12.         }
Apr 21 '13 #1
18 4641
r035198x
13,262 MVP
That line
Expand|Select|Wrap|Line Numbers
  1. System.out.println ("Delete Route " + temp_msi);
, did you get that ffrom some Java code somewhere? In C# you use Console.WriteLine instead.
Apr 22 '13 #2
slsv
14 New Member
Yes, is part of Java code.
I saw that in Java System.out.println is equivalent to Console.WriteLine in C#.. but when i change it i get more errors.. like:
Expand|Select|Wrap|Line Numbers
  1. bool ima = DatabaseConnection.checkExist(temp_msisdn);
'DatabaseConnection' does not exist in current context.
Expand|Select|Wrap|Line Numbers
  1. WriteLog.writeLog(...)
'WriteLog' does not exist in current context.

When is a 'System.out.println' i don't have this errors..
Apr 22 '13 #3
r035198x
13,262 MVP
Those errors are there because you didn't import the namespaces that contain those classes. The System.out.println doesn't fix those errors, it just hides them. Don't try to compile Java code using a C# compiler. Write proper C# code importing the required classes with the using clause.
Apr 22 '13 #4
slsv
14 New Member
Like I said, I'm a little bit new and I don't know exactly how to rewrite it in C#..
That's why i trying to work with this java piece of code..
I must do this piece of code in my first post to make it work in this condition. How can :
Expand|Select|Wrap|Line Numbers
  1.     string[] lines = File.ReadAllLines(@"pathtofile"); 
  2.             foreach (string line in lines)
  3.             {
  4.                 string[] columns = line.Split('|');
  5.                 string code = columns[2];
  6.                 if (code.Equals("D"))
  7.                 {
  8.                     mod.userDell);
  9.                     Console.WriteLine("");
  10.                 }
Basically read one file and when the flag is "D" must delete from DB
Apr 22 '13 #5
r035198x
13,262 MVP
If you need to write C# code then read a C# tutorial first. You can't just copy code from one language to another without understanding the syntax rules of the target language first.
Apr 22 '13 #6
slsv
14 New Member
Ok, thanks for the help.
Apr 22 '13 #7
vijay6
158 New Member
Hey slsv, till now what did you done with your code? Did you read your file? Did you connected to your database from your C# Program? If connected means, did you checked whether user is already existed or not in your table?
Apr 22 '13 #8
slsv
14 New Member
Hey vijya6, till now i successfully connected to database and read from file. So now i need to perform this action in my first post. While i read the file i check for flag "D" and when i have a line with this file I must delete.
Apr 22 '13 #9
vijay6
158 New Member
While i read the file i check for flag "D" and when i have a line with this file I must delete.
Hey slsv, what you want to delete?
Apr 22 '13 #10
slsv
14 New Member
Whole line and continue to next line.
Apr 22 '13 #11
vijay6
158 New Member
Whole line and continue to next line.
Hey slsv, you want to remove whole line only from your file?
Apr 22 '13 #12
slsv
14 New Member
it's only one file.. here is the scenario:
1.Connect and take the file.
2.Read the file and split it.
3.While reading the file if the char of this line is "d" i will delete the line and continue on next.

So far i have connection and reading.
I have this what to do if flag is 'D' ( first post ) then in my reading class i put this:
Expand|Select|Wrap|Line Numbers
  1. UserMod.UserMod mod = new UserMod.UserMod();
How to call it in here:
Expand|Select|Wrap|Line Numbers
  1. if (code.Equals("D"))
  2.                 {
  3.                     mod.userDell( // HERE ); <--- HERE 
  4.                     Console.WriteLine("");
  5.                 }
Apr 22 '13 #13
vijay6
158 New Member
Hey slsv, try this code...

Expand|Select|Wrap|Line Numbers
  1. string text = String.Empty;
  2.  
  3. string[] lines = System.IO.File.ReadAllLines(@"pathtofile");
  4. foreach (string line in lines)
  5. {
  6.     string[] columns = line.Split('|');
  7.     string code = columns[2];
  8.     if (!code.Equals("D"))
  9.     {
  10.         text = text + line + Environment.NewLine;
  11.     }
  12. }
  13.  
  14. text = text.Remove(text.Length - 1);
  15.  
  16. System.IO.File.WriteAllText(@"pathtofile", text);
Apr 22 '13 #14
slsv
14 New Member
Hey, thanks for this but how this is connected with this
Expand|Select|Wrap|Line Numbers
  1.  
  2.     public static void userDell(string msi,String filename, String DB_CONN_STRING)
  3.             {
  4.                 String temp_msisdn = "+" + msi;
  5.                 bool ima = DatabaseConnection.checkExist(temp_msi);
  6.                 bool result;
  7.                 if (ima) 
  8.                 {
  9.                     result = DatabaseConnection.deleteRoute(temp_msi);
  10.                 }
  11.                 System.out.println ("Delete Route " + temp_msi);
  12.                 WriteLog.writeLog(filename + "|OK|DELETE|" + temp_msi + "||" + "route deleted||\n", "logs", "1.log");
  13.             }
  14.  
  15.  
I want to use this?
Apr 22 '13 #15
vijay6
158 New Member
I want to use this?
Upto your wish!!!

Expand|Select|Wrap|Line Numbers
  1. public static void userDell(string msi,String filename, String DB_CONN_STRING)
  2. {
  3.     String temp_msisdn = "+" + msi;
  4.     bool ima = DatabaseConnection.checkExist(temp_msi);
  5.     bool result;
  6.  
  7.     if (ima)
  8.     {
  9.         result = DatabaseConnection.deleteRoute(temp_msi);
  10.     }
  11.  
  12.     System.out.println ("Delete Route " + temp_msi);
  13.     WriteLog.writeLog(filename + "|OK|DELETE|" + temp_msi + "||" + "route deleted||\n", "logs", "1.log");
  14. }
Hey slsv, I don't know what 'msi' means here. I assume 'msi' represents name (msi = "slsv"). This code checks whether your table in your database have row(s) with value as 'slsv' (Line number 4). If true (i.e., it have row(s) (Line number 7)) then it deleting all the row(s) which has msi as 'slsv' (Line number 9) and updating that in a textfile as 'slsv' deleted (Line number 13).

I'm sure my answer won't be absolutely right. Ask the person who wrote this code to know what this code is exactly doing...
Apr 22 '13 #16
slsv
14 New Member
Expand|Select|Wrap|Line Numbers
  1.  
  2.     if (code.Equals("D"))
  3.                     {
  4.                         //mod.userDell( // HERE ); <--- HERE 
  5.                         mod.userDell(columns[0], columns[1]);
  6.                         Console.WriteLine("");
  7.                     }
  8.  
  9.  
Apr 24 '13 #17
vijay6
158 New Member
Hey slsv, now you want to remove that line also from your database?
Apr 24 '13 #18
slsv
14 New Member
@vijay6,
this is what i needed and now is working:
Expand|Select|Wrap|Line Numbers
  1.  mod.userDell(columns[0], columns[1]);
Apr 24 '13 #19

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Anthony Liu | last post by:
I am trying to split a string like so: re.split(',|。|、|!|:|,|?|“|”|)|(|;', my_string) Python complains like so: Traceback (most recent call last): File "C:\Python23\codes\regextest.py",...
1
by: Jeremy | last post by:
I am (very) new top regular expressions and I am having a difficult time understanding how to do them. I have the following in my script: zaidsearch = r'''^ {5,}({4,5})(.\d{2,2}c)''' ZAIDSearch...
4
by: Carlos | last post by:
Hi all, I have the following event function, and the compiler is having a problem handling negative constant values. What can be happening? Thanks in advance.. private void...
4
by: York | last post by:
I have two backslash - a. and I want to replace them with one backslash, but I failed: Traceback (most recent call last): File "<stdin>", line 1, in ? File "/usr/lib/python2.3/sre.py", line...
1
by: Wehrdamned | last post by:
Hi, As I understand it, python uses a pcre engine to work with regular expression. My question is, then, why expressions like : Traceback (most recent call last): File "<stdin>", line 1, in...
1
by: Gert Cuykens | last post by:
rex2=re.compile('^"(?P<value>*)"$',re.M) File "/usr/lib/python2.5/re.py", line 180, in compile return _compile(pattern, flags) File "/usr/lib/python2.5/re.py", line 233, in _compile raise...
3
by: jgentes | last post by:
Hey, I am attempting to create a random password string, and I am getting a timeout error on the regular expression. its giving me errors on the checks. line 25/27/29/31 function...
5
by: Noah Hoffman | last post by:
I have been trying to write a regular expression that identifies a block of text enclosed by (potentially nested) parentheses. I've found solutions using other regular expression engines (for...
15
by: K Viltersten | last post by:
I've got a hint from a gentleman here to use the following syntax. public static FileInfo GetFilesRegExp(this DirectoryInfo di, string pat) { Regex re = new Regex(pat); return Array.FindAll(...
1
by: NewToOracle | last post by:
Hi, Can anybody please help me to fix below error. Isolate.Whencalled(()=> myfakeObject.Method1()).WillReturn("Method1"); At the myfakeObject it is showing Error Message: ")" Expected
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.