|
Hello !
Not yet
The table contain one auto-increment primary key and a few fields
2 of those fields can't be duplicated because they are alternate identifier for the entity
For now I didn't aplly any index on those fields but I'm looking for the best way to manage them, using MySql ADO and C#
Thank you for your reply !
|
|
|
|
|
baranils wrote: but I'm looking for the best way to manage them
Well I'm no database expert but it's possible that creating unique indexes in the database is the best practice approach or at least the first step.
led mike
|
|
|
|
|
You have to specify IN THE DATABASE that a given column must be unique.
If your database already contains data, make sure that none of the data in that column is a duplicate BEFORE setting the column to be unique.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Hi all,
Can you please assist me with any relevant code in Csharp/ASp.net that helps me reading a CSV file off an Ftp site and populate a table in my database.
Thank you very much.
|
|
|
|
|
Check out ye olde FtpWebRequest class, its like HttpWebRequest, but for FTP instead. What you end up with is a stream to the file, then you can read it like you would any other stream.
My current favourite word is: Nipple!
-SK Genius
|
|
|
|
|
Thank you very much.Your help is much appreciated.
Can you please give me a little more tips please?
Thank you.
|
|
|
|
|
|
Hi all. How i can make control reflect changes was maded on his datasource?
<br />
ctlTextEdit.DataBindings.Add(new Binding("EditValue", _mySourceDataRow, "Field1"));<br />
<br />
....<br />
<br />
void someButton_onClick(...)<br />
{<br />
_mySourceDataRow.Field1 = "New text";<br />
<br />
} <br />
<br />
Or exists an method in Form class what make all child controls reread values from ones data sources?
THANK.
|
|
|
|
|
|
I'm looking for more efficient Xml reading. I do not mean performance - I load small files. I'd rather ask about coding style/methods. Now I use the following routine:
public static void FromFile(string path, KorepetytorMenu menu)
{
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(path);
foreach (XmlNode rootNode in xmlDoc.ChildNodes) {
XmlElement rootEl = rootNode as XmlElement;
if (rootEl != null && rootEl.Name == "KorepetytorMenu") {
foreach (XmlNode node in rootEl.ChildNodes) {
XmlElement el = node as XmlElement;
if (el != null && el.Name == "RootNode") {
menu.rootNode = KorepetytorMenuNode.FromXmlElement(el);
ReadNodeChildsRecursive(menu.rootNode, el);
}
}
}
}
}
I just have been starting coding this, but I wrote some programs like this in the past and I know that it gets annoying when there are 10 or more nested foreach'es an if's.
A sample Xml file:
<?xml version="1.0" encoding="utf-8" ?>
<KorepetytorMenu>
<RootNode Header="" Image="">
<Node Header="Fizyka">
<Node Header="Równania Rózniczkowe" Image="Gwiazdka.png" />
<Node Header="Kinematyka 1" File="Matma\Równania Rózniczkowe.xml" />
(...)
</Node>
</RootNode>
</KorepetytorMenu>
Any ideas?
Thanks in advance.
Greetings - Gajatko
Portable.NET is part of DotGNU, a project to build a complete Free Software replacement for .NET - a system that truly belongs to the developers.
|
|
|
|
|
Just note: I do NOT want to use reflection to perform this task, because the first use of reflection causes a slow-down, so if I need it to show main menu, then... . I tried to use Xml Serialization system in .Net, but I didn't like it. It's too slow (as it uses reflection) and forces me to design class in a specific style which does not satisfy me. Cheers!
Greetings - Gajatko
Portable.NET is part of DotGNU, a project to build a complete Free Software replacement for .NET - a system that truly belongs to the developers.
|
|
|
|
|
Take a look at XPath and the Node.selectNodes(...) method
led mike
|
|
|
|
|
Ok I get it. Thanks.
public static void FromFile(string path, KorepetytorMenu menu)
{
XPathDocument doc = new System.Xml.XPath.XPathDocument(path);
XPathNavigator nav = doc.CreateNavigator();
if (!nav.MoveToChild("KorepetytorMenu", "")) return;
if (!nav.MoveToChild("RootNode", "")) return;
menu.rootNode = KorepetytorMenuNode.FromXmlNavigator(nav);
ReadNodeChildsRecursive(menu.rootNode, nav);
}
Is it a correct approach?
Greetings - Gajatko
Portable.NET is part of DotGNU, a project to build a complete Free Software replacement for .NET - a system that truly belongs to the developers.
|
|
|
|
|
gajatko wrote: Is it a correct approach?
Well I'm not sure what you are trying to do and that is certainly an improvement, but you still have not used XPath. If you want to access a possible set of elements you can use XmlNode.SelectNodes with an XPath statement and it is possible to get a collection of all the nodes you are interested in and then you simply iterate the list and do whatever operations you need for each XmlNode in the collection. See the example code in the documentation for XmlNode.SelectNodes()
led mike
|
|
|
|
|
Do you think of sth like this?:
static void ReadNodeChildsRecursive(KorepetytorMenuNode rootNode, XPathNavigator nav)
{
XPathNodeIterator iter = nav.SelectChildren(XPathNodeType.Element);
while (iter.MoveNext()) {
if (iter.Current.Name == "Node") {
rootNode.Nodes.Add(KorepetytorMenuNode.FromXmlNavigator(iter.Current));
ReadNodeChildsRecursive(rootNode.Nodes[rootNode.Nodes.Count - 1], iter.Current);
}
}
}
And...
public static KorepetytorMenuNode FromXmlNavigator(XPathNavigator nav)
{
return new KorepetytorMenuNode() {
File = nav.GetAttribute("File", "") ?? "",
Header = nav.GetAttribute("Header", "") ?? "",
Image = nav.GetAttribute("Image", "") ?? ""
};
}
Maybe I should post it in my previous message so it would be clear what did I do.
Greetings - Gajatko
Portable.NET is part of DotGNU, a project to build a complete Free Software replacement for .NET - a system that truly belongs to the developers.
|
|
|
|
|
Why don't you do it the easy way:
string myFileName = @"C:\test\my.xml";
DataTable data = new DataTable();
data.ReadXml(myFileName);
After you've done that, you can just retrieve the data from data.Rows...
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
What about a situation when I have many meaningfull attributes and xml represents a tree with unbounded complexity? I though that a DataTable doesn't support more than a finite number of sub-trees, does it? Maybe I missed something, however.
Greetings - Gajatko
Portable.NET is part of DotGNU, a project to build a complete Free Software replacement for .NET - a system that truly belongs to the developers.
|
|
|
|
|
You could try it and see what happens. That's part of the adventure of being a programmer.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Hi !,
I am new to C# and was wondering if the standard components included in .NET are usefull enough to build winforms ? Or better buy 3rd class libraries ?
Thanks you !
Best regards,
Steve
|
|
|
|
|
with standard controls, you can develope any application, however nearly all third party controls are for good looking GUI they may slow performance too
and for more info, just google
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87??6?N8?BcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i?TV.C\y<p?jxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
Steve Declerck,
Well, what do you want to do?, If its just simple form that inputs values into a DB, then sure, they are fine. If you want to display models and graphs, then, you'll need to buy some 3rd party libs.
Regards,
Gareth.
|
|
|
|
|
Hi Steve,
The standard .Net components are used to create WinFrom applications. However, it depends on your requirements or scope of your application. If .Net standard components meets your application's requirements then you can use them in your application in case if not then you may try ComponentOne's Studio Enterprise suite and evaluate it and see if those components can meet your requirements. Below is the link for the download.
http://download.componentone.com/pub/Net/c1studionet/Updates/C1StudioNET2_T307_Setup.exe[^]
For more information please visit www.componentone.com
I hope this helps .
Regards,
John Adams
ComponentOne LLC
|
|
|
|
|
Controversial one here, but why develop in WinForms? Take a look at WPF - done properly you can change the look of the app later on. See this[^] post by the WPF meister Josh Smith.
|
|
|
|
|
Hello folks,
Many thanks for the replies, very helpful. Indeed it's for application that inserts data in a DB. I will try the standard components !
Thanks,
Steve
|
|
|
|
|
I'm coding an FTP client in C#, and I'm trying to use System.Net.Socket's BeginReceive method to stop the UI from freezing when receiving data. At present, it works as it should, but whenever there's a transfer in progress (upload/download or directory listing), the UI freezes until it's complete.
I want to use BeginReceive to recive data in a different thread. This is what I have to far:
Two classes - FTP and FrmMain.
In FTP I have a delegate:
<br />
public delegate void DirListDelegate(object sender, ArrayList items);<br />
public event DirListDelegate OnDirListComplete;<br />
The I have three methods:
<br />
private void OnDataReceived(IAsyncResult asyn) {<br />
int bytes = dataSocket.EndReceive(asyn);<br />
bldBuffer.Append(Encoding.ASCII.GetString(buffer, 0, bytes));<br />
if(bytes < buffer.Length) {<br />
dataSocket.Close();<br />
OnDirListComplete(this, itemsList);<br />
} else {<br />
WaitForData();<br />
}<br />
}<br />
private void WaitForData() {<br />
dataSocket.BeginReceive(buffer, 0, buffer.Length, SocketFlags.None, new AsyncCallback(OnDataReceived), null);<br />
}<br />
public void ListDir() {<br />
dataSocket = openSocket();<br />
<br />
bldBuffer.Remove(0, bldBuffer.Length);<br />
WaitForData();<br />
}<br />
Then I call FTP.ListDir() from FrmMain. What should happen is the main program should be free to respond to user clicks etc and not freeze, but it's as though I'm just using Receive instead of BeginReceive.
I'm really stuck on this and I'd appreciate any help.
|
|
|
|