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 - public static void userDell(string msi,String filename, String DB_CONN_STRING)
-
{
-
String temp_msisdn = "+" + msi;
-
bool ima = DatabaseConnection.checkExist(temp_msi);
-
bool result;
-
if (ima)
-
{
-
result = DatabaseConnection.deleteRoute(temp_msi);
-
}
-
System.out.println ("Delete Route " + temp_msi);
-
WriteLog.writeLog(filename + "|OK|DELETE|" + temp_msi + "||" + "route deleted||\n", "logs", "1.log");
-
}
18 4641
That line - System.out.println ("Delete Route " + temp_msi);
, did you get that ffrom some Java code somewhere? In C# you use Console.WriteLine instead.
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: - bool ima = DatabaseConnection.checkExist(temp_msisdn);
'DatabaseConnection' does not exist in current context.
'WriteLog' does not exist in current context.
When is a 'System.out.println' i don't have this errors..
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.
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 : -
string[] lines = File.ReadAllLines(@"pathtofile");
-
foreach (string line in lines)
-
{
-
string[] columns = line.Split('|');
-
string code = columns[2];
-
if (code.Equals("D"))
-
{
-
mod.userDell);
-
Console.WriteLine("");
-
}
Basically read one file and when the flag is "D" must delete from DB
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.
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?
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.
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?
Whole line and continue to next line.
Whole line and continue to next line.
Hey slsv, you want to remove whole line only from your file?
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: - UserMod.UserMod mod = new UserMod.UserMod();
How to call it in here: - if (code.Equals("D"))
-
{
-
mod.userDell( // HERE ); <--- HERE
-
Console.WriteLine("");
-
}
Hey slsv, try this code... - string text = String.Empty;
-
-
string[] lines = System.IO.File.ReadAllLines(@"pathtofile");
-
foreach (string line in lines)
-
{
-
string[] columns = line.Split('|');
-
string code = columns[2];
-
if (!code.Equals("D"))
-
{
-
text = text + line + Environment.NewLine;
-
}
-
}
-
-
text = text.Remove(text.Length - 1);
-
-
System.IO.File.WriteAllText(@"pathtofile", text);
Hey, thanks for this but how this is connected with this -
-
public static void userDell(string msi,String filename, String DB_CONN_STRING)
-
{
-
String temp_msisdn = "+" + msi;
-
bool ima = DatabaseConnection.checkExist(temp_msi);
-
bool result;
-
if (ima)
-
{
-
result = DatabaseConnection.deleteRoute(temp_msi);
-
}
-
System.out.println ("Delete Route " + temp_msi);
-
WriteLog.writeLog(filename + "|OK|DELETE|" + temp_msi + "||" + "route deleted||\n", "logs", "1.log");
-
}
-
-
I want to use this?
I want to use this?
Upto your wish!!! - public static void userDell(string msi,String filename, String DB_CONN_STRING)
-
{
-
String temp_msisdn = "+" + msi;
-
bool ima = DatabaseConnection.checkExist(temp_msi);
-
bool result;
-
-
if (ima)
-
{
-
result = DatabaseConnection.deleteRoute(temp_msi);
-
}
-
-
System.out.println ("Delete Route " + temp_msi);
-
WriteLog.writeLog(filename + "|OK|DELETE|" + temp_msi + "||" + "route deleted||\n", "logs", "1.log");
-
}
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...
-
-
if (code.Equals("D"))
-
{
-
//mod.userDell( // HERE ); <--- HERE
-
mod.userDell(columns[0], columns[1]);
-
Console.WriteLine("");
-
}
-
-
Hey slsv, now you want to remove that line also from your database?
@vijay6,
this is what i needed and now is working: - mod.userDell(columns[0], columns[1]);
Sign in to post your reply or Sign up for a free account.
Similar topics
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",...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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(...
|
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
|
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,...
|
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...
|
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,...
|
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...
|
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...
|
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,...
|
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...
|
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 ...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |