|
private void Dig(string file)
{
DirFiles = Directory.GetFileSystemEntries(file);
foreach (string subFile in DirFiles)
{
FileInfo SubFi = new FileInfo(subFile);
if (!SubFi.Attributes.ToString().Contains("Directory"))
if (!listBox1.Items.Contains(subFile))
listBox1.Items.Add(subFile);
else
Dig(subFile);
}
}
I think I have the guts to do it after all
C'mon, give me five
All generalizations are wrong, including this one!
(\ /)
(O.o)
(><)
|
|
|
|
|
Hi,
I am trying to open a MS Access database from C# code.
I want the MSAccess database to open up on a button click.
Am able to create a connection to the database but am unable to open the database.
i want the database to be open on a button click event so that i can open a table.
Atached below is my code.Any help is welcome .
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using ADOX;
using System.Data.OleDb;
using System.Runtime.InteropServices;
namespace DatabaseCreation
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
string strAccessConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + txtdatabaseName.Text;
OleDbConnection myAccessConn = null;
try
{
myAccessConn = new OleDbConnection(strAccessConn);
myAccessConn.Open();
MessageBox.Show("Database connection is successfully Opened");
}
catch (Exception ex)
{
MessageBox.Show("Error: Failed to create a database connection. \n{0}", ex.Message);
}
if (myAccessConn.State == ConnectionState.Open)
{
myAccessConn.Close();
MessageBox.Show("Database is successfully Closed");
}
}
}
}
modified on Wednesday, April 23, 2008 5:40 AM
|
|
|
|
|
So you know in the future. If no one has responded to your question you have the ability to delete the message using the 'Delete' button in the lower right hand corner of the message.
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my homepage Oracle Studios[ ^]
|
|
|
|
|
Hi ,
I create a xml string using a xmldocument (c# 2.0 )
This is my code (more or less)
XmlElement MySearchNode = xmlDoc.CreateElement("MySearch");
xmlDoc.AppendChild(MySearchNode);
...
XmlNode node1 = xmlDoc.SelectSingleNode("/MySearch/Objects");
XmlAttribute nameAttrib = xmlDoc.CreateAttribute("result");
nameAttrib.Value = "012";
node1.Attributes.Append(nameAttrib);
xmlDoc.outerxml
I want to validate the xml string against a XSD :
XmlReader rdr = null;
XmlParserContext context = new XmlParserContext(null, null, "", XmlSpace.None);
XmlTextReader readerXml = new XmlTextReader(p_xml, XmlNodeType.Element, context);
XmlTextReader readerSchema = new XmlTextReader(p_xsdPath);
XmlSchema schema = new XmlSchema();
schema = XmlSchema.Read(readerSchema, new
ValidationEventHandler(Schema_ValidationEventHandler));
XmlReaderSettings ReaderSettings = new XmlReaderSettings();
ReaderSettings.ValidationType = ValidationType.Schema;
ReaderSettings.Schemas.Add(schema);
ReaderSettings.ConformanceLevel = ConformanceLevel.Fragment;
ReaderSettings.ValidationEventHandler += new
ValidationEventHandler(settings_ValidationEventHandler);
rdr = XmlReader.Create(readerXml, ReaderSettings);
this is my XSD
(a part of it)
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="MySearch">
<xs:complexType>
<xs:sequence>
<xs:element name="Objects" type="tObjects" minOccurs="0" maxOccurs="1" />
</xs:sequence>
<xs:attribute name="result" type="xs:string" />
</xs:complexType>
</xs:element>
<xs:complexType name="tObjects">
<xs:sequence>
<xs:element name="House" type="tHouse" minOccurs="0" maxOccurs="unbounded">
</xs:element>
<xs:element name="Garden" type="tGarden" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
....
Note : this is my xml string
<MySearch>
<Objects result = '012' >
<House>
...
</House>
</Objects>
</MySearch>
when I validate I get this error :
The 'result' attribute is not declared.
I see that validation process need :
ReaderSettings.ValidationFlags = XmlSchemaValidationFlags.AllowXmlAttributes;
and
attributeFormDefault="unqualified" .
It doesn't work !! I always get the same error ..
Could you help me ? thanks in advance .
|
|
|
|
|
I Have Return the validation expression(Alpha,Numeric,special character) in three regular expression.
How to write the multiple validation expression in single Regular Expression.
Alpha
******
Regex rx = new Regex(@"^[a-zA-Z]+$");
Numeric
*******
Regex rx1 = new Regex(@"^\d+$");
special character
*****************
Regex rx2 = new Regex("[@#$%^&*()_+=?><.,\":;~`|\\?/}{]+$");
|
|
|
|
|
I have heard that .NET framework is redistributable..
Does it mean that it is free??
If I build a client application in .NET, certainly I would need the framework, that why I want to know that can I install it in the clients system without any licensing hassles??
Are all latest frameworks free or the only the old ones? (upto 2.0) ??
|
|
|
|
|
Yes, all versions (so far) are free. I believe that framework 2 is usually included with Vista - I don't run Vista so I'm not sure.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
What made you think they were not be ? Did you try searching for info ?
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
So what is the Difference between .NET framework 3.0 and .NET framework 3.0 redistributable package??
|
|
|
|
|
One is the whole framework, which is free, and can be used to write apps, even without visual studio. The other is just the bit the end user needs to run your code.
There is a free IDE as well, so I don't think many people use just the free framework anymore.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Christian Graus wrote: One is the whole framework, which is free, and can be used to write apps, even without visual studio.
Now this is very interesting..
Culd you please elaborate more on this?
How can I write apps in .NET framework without Visual Studio??
Do I have to use an editor of some other vendor for this?
|
|
|
|
|
ptr2void wrote: How can I write apps in .NET framework without Visual Studio??
Sharpdevelop [^] is an open source IDE .
BTW Visual C# Express Edition [^] is free.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
I used SharpDevelop in College...
*Shudders*
Visual C# Express Edition or Notepad :p (Or preferably EditPad Lite instead of Notepad, but that's just me... )
|
|
|
|
|
I fully disagree : I used Sharpdevelop (only a bit, I admit) and like it.
Visual C# Express Edition is great value for money (BTW Notepad++ is much better than Notepad ).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
Great value for money... Lol :p
And my response with my SharpDevelop experience might be directly related to the fact that I was using it in 2005, when it was still in Beta....
|
|
|
|
|
Is Visual Studio still in beta or am I wrong?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
You may use Notepad if you wish. The compiler is a free download.
|
|
|
|
|
|
Hello everyone,
I am confused after reading the exitContext parameter from MSDN,
http://msdn2.microsoft.com/en-us/library/kzy257t0(VS.80).aspx
What does the context mean? Does it mean if I acquire some lock (e.g. lock, readwrite lock, monitor) before invoking WaitOne, then when calling WaitOne, the locks are automatically released?
So, when the thread is waking up again by signal from WaitOne or timeout from WaitOne, it will have to try to acquire the lock or locks again before execution?
thanks in advance,
George
|
|
|
|
|
|
Thanks Urs,
Looks like it has nothing to do with locks, as I listed in the original question?
regards,
George
|
|
|
|
|
How I can create an windows form application in C# that it doesn't need to framework when it run?
|
|
|
|
|
Two options
1 - buy an expensive tool that will do this for you
2 - pray
why would everyone be distributing the framework if there was an easy way to avoid it ?
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Christian Graus wrote: 1 - buy an expensive tool that will do this for you
2 - pray
Good one Christian, I just cant agree more, I've been to this struggle and I happily gave it up in the end!
All generalizations are wrong, including this one!
(\ /)
(O.o)
(><)
|
|
|
|
|
Christian Graus wrote: 2 - pray
Best one I've heard today.
Excellence is doing ordinary things extraordinarily well.
|
|
|
|