|
Thanks for your reply. But i have not so much knowledge in c#. If you give some coding help then it's very helpful for me
|
|
|
|
|
I'll be happy to assist you, but, if you can't tell me what format the data imported from Excel is in ... or, show me the working code you have now that imports the data: I can't offer any useful advice.
«Where is the Life we have lost in living? Where is the wisdom we have lost in knowledge? Where is the knowledge we have lost in information?» T. S. Elliot
|
|
|
|
|
I imported from excel using OleDb. now I can't be shorting data. this code now I'm trying..
string stringconn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + tbxSelect.Text + ";Extended Properties=\"Excel 8.0;HDR=Yes;\";";
OleDbConnection conn = new OleDbConnection(stringconn);
if (tbxSelect.Text != "")
{
OleDbDataAdapter da = new OleDbDataAdapter("Select * from [" + tbxChoice.Text + "$]", conn);
DataTable dt = new DataTable();
dt.Clear();
da.Fill(dt);
for (int i = 0; i < dt.Rows.Count; i++)
{
string firstRow = dt.Rows[i]["A"].ToString();
if (firstRow != "")
{
cmbRow1.Items.Add(firstRow);
if (!firstRow.Equals(Row1))
{
RowIndex_1++;
}
Row1 = firstRow;
}
MessageBox.Show(i.ToString(),RowIndex_1.ToString());
}
for (int j = 0; j < dt.Rows.Count; j++)
{
string secondRow = dt.Rows[j]["B"].ToString();
if (secondRow != "")
{
cmbRow2.Items.Add(secondRow);
if (!secondRow.Equals(Row2))
{
RowIndex_2++;
}
Row2 = secondRow;
}
MessageBox.Show(j.ToString(), RowIndex_2.ToString());
}
for (int k = 0; k < dt.Rows.Count; k++)
{
string secondRow = dt.Rows[k]["C"].ToString();
if (secondRow != "")
cmbRow3.Items.Add(secondRow);
}
for (int l = 0; l < dt.Rows.Count; l++)
{
string secondRow = dt.Rows[l]["D"].ToString();
if (secondRow != "")
cmbRow4.Items.Add(secondRow);
}
for (int m = 0; m < dt.Rows.Count; m++)
{
string secondRow = dt.Rows[m]["E"].ToString();
if (secondRow != "") ;
}
MessageBox.Show((dt.Rows.Count).ToString());
conn.Close();
}
else
MessageBox.Show("Er");
|
|
|
|
|
Don't do it like that! Never concatenate strings to build a SQL command. It leaves you wide open to accidental or deliberate SQL Injection attack which can destroy your entire database. Always use Parameterized queries instead.
When you concatenate strings, you cause problems because SQL receives commands like:
SELECT * FROM MyTable WHERE StreetAddress = 'Baker's Wood' The quote the user added terminates the string as far as SQL is concerned and you get problems. But it could be worse. If I come along and type this instead: "x';DROP TABLE MyTable;--" Then SQL receives a very different command:
SELECT * FROM MyTable WHERE StreetAddress = 'x';DROP TABLE MyTable; Which SQL sees as three separate commands:
SELECT * FROM MyTable WHERE StreetAddress = 'x'; A perfectly valid SELECT
DROP TABLE MyTable; A perfectly valid "delete the table" command
And everything else is a comment.
So it does: selects any matching rows, deletes the table from the DB, and ignores anything else.
So ALWAYS use parameterized queries! Or be prepared to restore your DB from backup frequently. You do take backups regularly, don't you?
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Note: it's possible the Excel range you show has 'split row; and, there are other ways you can create simulated hierarchies in Excel: that's why is crucial to examine the structure of the DataTable.
You need to do this: insert this code after the line beginning: da.Fill(dt);
for (int i = 0; i < dt.Rows.Count; i++)
{
DataRow row = dt.Rows[i];
Console.Write($"row: {i}\t");
for (int j = 0; j < dt.Columns.Count; j++)
{
Console.Write($"{row[j]}\t");
}
Console.WriteLine();
} Put a break-point just after this inserted code. Run the code. When it stops at the break-point, copy the output in the Console Window, and save it so you can study it. Post it here.
Study the structure revealed, and start thinking of what has to happen to map that to the ComboBoxes.
«Where is the Life we have lost in living? Where is the wisdom we have lost in knowledge? Where is the knowledge we have lost in information?» T. S. Elliot
|
|
|
|
|
Thank you! I think it is a great idea. I will try and let's see
|
|
|
|
|
Data comes with this format. what is a good way to rearrange it
row: 0 menu1 submenu11 child111 item1111
row: 1 item1112
row: 2 child112 item1121
row: 3 item1122
row: 4 item1123
row: 5 submenu12 child121 item1211
row: 6 child122 item1221
row: 7 item1222
row: 8 menu2 submenu21 child211 item2111
row: 9 item2112
row: 10 item2113
row: 11 child212 item2121
row: 12 child213 item2131
row: 13 submenu22 child221 item2211
row: 14 menu3 submenu31 child311 item3111
row: 15
row: 16
row: 17
row: 18
row: 19
row: 20
|
|
|
|
|
That's an important step: start thinking about how you would use the 'menu, 'submenu, 'child, and 'item labels to create the tree structure.
«Where is the Life we have lost in living? Where is the wisdom we have lost in knowledge? Where is the knowledge we have lost in information?» T. S. Elliot
|
|
|
|
|
To be sure the structure shown is accurate, we need to check for the presence of "DBNull" values: please run this code and show the result:
for (int i = 0; i < dt.Rows.Count; i++)
{
DataRow row = dt.Rows[i];
Console.Write($"row: {i}\t");
for (int j = 0; j < dt.Columns.Count; j++)
{
var cvalue = row[j];
string cstr = cvalue is DBNull ? "DBNull" : row[j].ToString();
Console.Write($"{cstr}\t");
}
Console.WriteLine();
}
«Where is the Life we have lost in living? Where is the wisdom we have lost in knowledge? Where is the knowledge we have lost in information?» T. S. Elliot
|
|
|
|
|
I able to solve the problem... thank you very much
i just scan ever row then match its child row. like this
menu1---submenu11---child111----item1111
menu1---submenu11---child111----item1112
menu1---submenu11---child112----item1121
|
|
|
|
|
Overly simplified:
public class MyMenuItem
{
public MyMenuItem Parent { get; set; }
public string Header { get; set; }
public List<MyMenuItem> Children { get; set; }
public MyMenuItem(string header, MyMenuItem parent=null)
{
this.Parent = parent;
this.Header = header;
this.Children = new List<MyMenuItem>();
}
}
List<MyMenuItem> MenuItems = new List<MyMenuITem>();
Populate the MenuItems appropriately, and have a ball. I'm not sure why you're putting menu items into comboboxes, but whatever...
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
|
Yeah, I read that before, but it still doesn't answer my "I'm not sure why" remark.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
OP is probably thinking "listviews" (as you said, the combo part is not much use in this case).
The Master said, 'Am I indeed possessed of knowledge? I am not knowing. But if a mean person, who appears quite empty-like, ask anything of me, I set it forth from one end to the other, and exhaust it.'
― Confucian Analects
|
|
|
|
|
Even if that was the case, what has it got to do with a listview?
The whole question kinda sucks...
|
|
|
|
|
I looked at his "picture".
It's not all that silly. Like tumblers ... if you can imagine ....
The Master said, 'Am I indeed possessed of knowledge? I am not knowing. But if a mean person, who appears quite empty-like, ask anything of me, I set it forth from one end to the other, and exhaust it.'
― Confucian Analects
|
|
|
|
|
Before any further reading, i want to apologise for posting this question here, and im aware im hurting my reputation by doing this, but im really desperate. If is very unappropriated, i will delete it myself. But if you can help me with a solution to my problem... oh boy. I wrote to malwarebytes Forum the same question,and now im waiting. But on other AV websites, its just problematic to even log in to their forums, from my side at least: avast,avg,norton. You guys here i really respect and i hope you can help me more than 'dedicated' chaps out there.
I wonder if is a MANUAL way possible of cleaning those 'infections', that i strongly suspect is just a parameter written in the executable file. Or if only automatic way exists... Either way, i need a way to preserve my bunch of stuff that i'm so scared to loose at this time.
------------------ here is my problem:
I keep the instalation software that i tested and i liked. I am doing it for years. I have a special folder with all my instalations kits, and i gathered in time somewhere like 200 perhaps. So when i have to reinstal my windows, i reinstall my usual software from that folder. Thats it's purpose, a backup.
Some time ago, i received a troian (virus), and i manage to clean it yesterday from my C partition and from windows too. But i scanned my D drive also, where this folder i have with all the instalation kits. And nearly all the executables are found infected with this latest trojan and from other old ones i had in the past. I am a bit desperate about this situation because i can not get back the specific software versions i gathered anymore.
Is there a posibility to clean all these installers? But not cleaning by deletion or quarantine, but cleaning the actual virus that is inside them/or/attach to them ? And leave intact my instalation kit, ready to use another time, uncorupted or damaged?
I used: MalwareBytes free version and also AVG antivirus free version. Both softwares didnt clean eficiently from windows scan. Only from boot scan! But im refering for the elimination of all windows infections. Drive D is well scanned from windows and eficient enough.
These are the viruses that are infecting my installers:
win32: Gardih (this was the latest one)
win32: Crypt-SJB [Trj] (this was the latest one)
win32: Evo-gen [Susp]
win32: Rootkit-gen [Rtk]
win32: MalwareX-gen [Trj]
win64: Trojan-gen
FileRepMalware
MSIL:GenMalicious-AAS [Trj]
BV: ExitWindows-K [Trj]
BV: Agent-BGV [Expl]
Other: Malware-gen [Trj]
Thank you !
|
|
|
|
|
Would I risk it? No. Unless your antivirus - and this if nothing else should convince you to get one and use it - can disinfect all the files for you, there is no good way to remove a mess of virii from your system.
Me? I'd reformat and restore the whole thing from a clean backup just to be sure - I've seen cases in the past when multiple virii make it next to impossible to get rid of them all and a complete reset is the best - and quickest - way to proceed.
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
It's the only way to be sure[^].
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Wise words! If they had listened, they might have survived ...
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
@OriginalGriff You're still believe I have a operating system virus problem. But that i resolve it already using a boot scan cleaning. Im asking something else instead. On non operating system, on a diferent drive, drive D in my case, where everything is STORED, and very rarely executed, there inside all those (pasive) installers, the AV found infected executables, that are most of the time passive.
That is the issue. I moved away all the installers on external drive, AntiVirus scan D drive and eliminate majority of exe in there, since its automatic, and then i copy back from my external drive to the D drive all the infected originals, in the hope there is a way to repair them. Im not talking about C drive program files stuff where is installed everything. But passive storred programs, on diferent drive away from C. All i want is to clean them.
|
|
|
|
|
No, I believe that you've had a massive virus problem - and once this is over you need to do two things:
1) Identify where the viruses came from and put systems in place to ensure this doesn't happen again.
And
2) Install a good quality AV, and keep it updated and scanning regularly.
If whatever you used to remove the viruses from your system disk can't safely get rid of the virus problem on the data drive, then those files are screwed: modern viruses are complicated beasties who mutate code in files, not just add to it (they try to hide by not adding identifiable strings) - so unless the virus scanner knows exactly what a virus did to the file, it can't be undone. And when you get multiple infections it very quickly becomes impossible to work out the order in which the code was corrupted and thus have no idea what the original looked like. Without that, your files will be and will always remain too dangerous to run - and must be replaced with "clean" versions, either from backup, or by re-install.
Me? If I find a computer with that many viruses, I will always reformat and load from clean - because I've seen the results when multiple viruses start "fighting" among themselves and the problems that causes the AV scanner. It's honestly quicker, easier, and safer to start over from scratch!
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
@OriginalGriff Very interesting what you tell me. I didn't think on this 'mutation' ability before. In reality, my installers (some of them) have cracks too. And patches. And some of them i know they are 'infected' but with old and too general viruses that are very easy to remove from a single quick scan. Those files were see as being the latest and meanest viruses on earth from this late and updated AV perspective. They are treating almost everything as the 'highest risk' and every executable that it finds. I like more those old AV they were more dedicated than these general atitude from today. But that is me. I scanned my backup software from another OS, from a laptop, and it find those eazy cracks viruses. I also scanned with a very old AV as well and it confirmed this (forgotten) reality. Eh well. The conclusion, the secondary external scan, didn't find those mean viruses that i get from my PC. So my installers are not 'infected' by anything new that lurks in my computer. In the best case is a false positive. In reality, is a wrapper of some sort attributing the same virus signature to every installer i have there. Or its just how the new AV think these days, if he found a high level virus, then everything it finds it must be that high.
|
|
|
|
|
and from other old ones i had in the past.
The Master said, 'Am I indeed possessed of knowledge? I am not knowing. But if a mean person, who appears quite empty-like, ask anything of me, I set it forth from one end to the other, and exhaust it.'
― Confucian Analects
|
|
|
|
|
_Q12_ wrote: Is there a posibility to clean all these installers? No; part of the original gets overwritten. Data that is overwritten is lost and cannot be retrieved.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|