|
Thank's for the help
But what whit the Code ?
I need the code, I need that all the function of the Form will work too
|
|
|
|
|
what code? Didn't you ask to copy Form+Code?
Yusuf
|
|
|
|
|
One way to do this is to select your form in Solution Explorer, then from the File menu select Save <your form name here> AS... and save it with the new name. Then right click on the project in Solution Explorer and select Add | Existing Item... , navigate to the old form and select it.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
I've got a program I've written that uses an Access Database for a backend. I've been using it on XP for awhile now with no issues. However recently I've got a new user who has Vista 64 bit. My application crashes before it even finishes loading. Using some debug code in a custom compile I did for him I've narrowed it down to the following section of code:
string sAppPath = (System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase)).Replace("file:\\", "");
public System.Data.OleDb.OleDbConnection DBConnection = new System.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + (sAppPath + "\\Database.mdb"));
sSQLStatement = ("SELECT Filename FROM Scriptures");
System.Data.OleDb.OleDbCommand SQLCommand = new System.Data.OleDb.OleDbCommand(sSQLStatement, DBConnection);
try
{
if (DBConnection.State.ToString() == "Closed") DBConnection.Open();
System.Data.OleDb.OleDbDataReader DataReader = SQLCommand.ExecuteReader();
while (DataReader.Read())
{
}
DataReader.Close();
DBConnection.Close();
}
The program crashes on this line:
if (DBConnection.State.ToString() == "Closed") DBConnection.Open();
I'm at a loss as to why this would work on XP but not Vista. I don't have a Vista machine readily available for testing at this time.
Any help would be greatly appreciated. Thanks!
|
|
|
|
|
First off, you really need to get yourself a good C# book and do some reading, because you have some serious fundamental flaws in your code. The Database connection State is an Enumerated type (see example usage[^]), you need not cast it to a String and then compare, you should be comparing the Enumerated types. Additionally, you should really make use of Using[^] statements in your code, it will make for cleaner code, and will ensure the objects are probably closed and disposed.
I see one potential problem, in that you're creating an instance of a SQLCommand using a connection object that might be null; and to top it off, you're doing that outside the scope of your Try/Catch block.
See this line: System.Data.OleDb.OleDbCommand SQLCommand = new System.Data.OleDb.OleDbCommand(sSQLStatement, DBConnection);
If you're not sure if the connection has been created and opened, then you should do that first. Once you have a valid connection, THEN create your SQL Command and hook that up to the connection and execute your query (see Example[^] on MSDN)
But seriously, go read about Enumerated types and Using statements, and hopefully this will help you over come your problem.
Last modified: 13mins after originally posted --
|
|
|
|
|
From what I know there are no 64 bit ODBC drivers for MS Access
|
|
|
|
|
It the application is specifically targeted to x86, it should default to use the 32-bit driver.
|
|
|
|
|
Hello,
i'm writing a malware detection system, and i want to find a way to monitor downloaded files, i could use FileSystemWatcher but i need to find possible malicious hosts to possibly block them using my firewall, any ideas on that? i've already written code for the database files and the comparision algorithms
i also have some experience in the task i need, i've done a project using C last year to monitor tcp packets for syn flood patterns,though this time the packet is not enough, i need to compare the full downloaded file
Thank you.
|
|
|
|
|
you need to implement the snifer ,you should capture the packet and analyze that if this packet is transfering any file then if yes then you enable your firewall
|
|
|
|
|
analyzing a single packet at a time will trigger loads of false alarms, i need to scan a file once it's downloaded, but still, if i use this how will i know that a file is being downloaded? and where to?
|
|
|
|
|
Hi,
I am able to open and display an Excel sheet but I would like to locate some headers by name.
Thanks
|
|
|
|
|
Are you using Microsoft.Office.Interop.Excel ?
Calin
|
|
|
|
|
Hello Calin, I am using Microsoft.Office.Interop.Excel but I don't know how to parse the header row to look for specific words, like, Power, Failure Rate etc.
Any help would be greatly appreciated.
alvas89
|
|
|
|
|
You could use the interop assemblies, which requires Office to be installed, or you could use an approach similar to this[^], which accesses the spreadsheet using a connection string in much the same way as a database. You can then access the individual sheets, rows, columns and cells
|
|
|
|
|
Hello Computafreak, I use the interop but I don't know how to read one or two specific header that include some leywords like Power or Failure rate etc. Being able to read all the rows hasn't helped me so far. I need a more specific info.
Thanks for your suggestions,
alvas89
|
|
|
|
|
hi
i want to execute a file in a CD image (iso, nrg, ...)
image format is not matter!
i want to convert several file of a software to a single file (image) and write an extra program in C# that run the program in image! so others can not see my software components!
plz help me if you can wrap software components(dll,image,audio,...) in anyway that anyone can not see thats component easyly when use the software.
Additional expand
i am writing a game, i dont want to anyone can grab my game image & audio & ... but my game engine can not support encryption! so i want to wrap my game with all its resource!
modified on Sunday, March 1, 2009 4:36 PM
|
|
|
|
|
Making it a common CD image format seems like a bad way to protect anything.
Why are you worried about users seeing the components anyway? If they want to use it, they don't want to break it.. (and even if they do, it's their problem)
An easy way to "hide" the components would be to zip them together and give it an other extension (say, .dat), regular users wouldn't mess with it and that sounds precisely like what you want. You could use #ZipLib[^] for this, it's free (and the license is friendly).
|
|
|
|
|
See Harolds response.
Also google for '.NET obfuscator'. Obfuscators mess with the code, don't worry it still runs, in a way that makes it difficult for others to read. Which is sort of what you want to achieve.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Hi,
Here i want to improve display of node attributes such that only node name is added to tree and attributes of clicked node appear in GUI controls on right hand side of form.
NodeType is of enumarated type XmlNodeType, yet the values are compared as strings.What should be there instead of strings?How to use enumerated data types?
How to get rid of While loop in Treeview1_AfterSelect(), it may go in infinite loop?
Please help out in providing right part of code to be used..
Thanks in advance..
public partial class TreeDisplay : Form
{
public string Filename
{ get { return filename; } }
protected string filename;
private void initiatingTree(string nameofFile)
{
treeView1.Nodes.Clear();
if (xmlDocument.DocumentElement != null) treeView1.Nodes.Add(new TreeNode (xmlDocument.DocumentElement.Name));
TreeNode tNodeObj = treeView1.Nodes[0];
XmlNode xNode = xmlDocument.DocumentElement;
AddingNodesToTree(xNode,tNodeObj);
treeView1.Nodes[0].Expand();
treeView1.CollapseAll();
}
private static void AddingNodesToTree(XmlNode xmlNode,TreeNode tnode)
{
if (xmlNode.HasChildNodes)
{
XmlNodeList nodeList = xmlNode.ChildNodes;
for (int i = 0; i <= nodeList.Count - 1; i++)
{ XmlNode xmladdtreeNode = xmlNode.ChildNodes[i];
String nodetype = "" + xmladdtreeNode.NodeType;
if (nodetype.Equals("Text") || nodetype.Equals("Comment"))
{
tnode.Nodes.Add(new TreeNode(xmladdtreeNode.InnerText));
}
else
{
String name = "<" + xmladdtreeNode.Name;
XmlAttributeCollection attCol = xmladdtreeNode.Attributes;
foreach (XmlAttribute xmlatt in attCol)
{
name += " " + xmlatt.Name + "=\"" + xmlatt.Value + "\"";
}
name += ">";
TreeNode tn = new TreeNode(xmladdtreeNode.Name);
tn.Text = name;
tnode.Nodes.Add(tn);
TreeNode treeNode = tnode.Nodes[i];
AddingNodesToTree(xmladdtreeNode,treeNode);
}
}
}
else
{ tnode.Text = xmlNode.OuterXml.Trim();
}
}
private void treeView1_AfterSelect(object sender,TreeViewEventArgs e)
{
listBox1.Items.Clear();
TreeNode treenode = e.Node;
String text = treenode.Text;
String relevent = text;
Boolean flag = true;
while (flag)
{ int SpaceIndex = relevent.IndexOf(" ");
if (SpaceIndex != -1)
{ int indexofEqual = relevent.IndexOf('=', SpaceIndex);
if (indexofEqual != -1)
{ int indexOFValue = relevent.IndexOf("\"", indexofEqual + 2);
if (indexOFValue != -1)
{
String attribute = relevent.Substring(SpaceIndex + 1, indexofEqual - SpaceIndex - 1);
String value = relevent.Substring(indexofEqual + 2, indexOFValue - indexofEqual - 2);
listBox1.Items.Add("Attribute:" + attribute + "Value:" +value);
releventreleventreleventrelevent = relevent.Substring(indexOFValue);
}
else
{ listBox1.Items.Add("Bad format of the xml file for this node");
flag = false;
} }
else
{ flag = false;
} }
else
{ flag = false; }
} }
}
|
|
|
|
|
hello,
i developed a c# program which unfortunatly cannot run on WINDOWS95 , 98 etc.
is there a way to fish the windows version as soon as i start my application ?
coz if its not the right one i'll just abort. better than letting the software spread its wings and fly..
thanks in advance,
avi
|
|
|
|
|
|
Additionally, I don't think the .Net framework can run on Windows 95 anyway, so there's no need to check for that in the OSVersion property
|
|
|
|
|
Well he also said "etc"
|
|
|
|
|
tnx guys,
anyways , what will happen if the prog will try to run
on an OS without the FrameWork installed?
will fireworks accur or will it pop up something ?
|
|
|
|
|
It will give a very cryptic error message that none of my customers every understood.
The fireworks will come from the user who screams at you "what the heck is this 2 point whateverthefuckitwas and how do I get it??"
|
|
|
|