|
They create properties for you, without you having to do it. variables instead of properties that are publically visible are poor form.
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
I need help in updating a database using a dataset.
Im tryin to update using a value stored in a variable .
this is the code:
stocktrackerDataSet changes = (stocktrackerDataSet)stocktrackerDataSet.GetChanges();
Usage = retail_ProductsTableAdapter.Update(changes);
MessageBox.Show("updated " + Usage , "Success");
stocktrackerDataSet.AcceptChanges();
Im gettin an argumentnull exception
Please can some one help me ?
|
|
|
|
|
c#_novice wrote: Im gettin an argumentnull exception
It would be good to know where you are getting that exception as it makes it easier to help you. However, there are a limited number of places you could get that exception in the code you've shown.
My guess is that the ArgumentNullException was triggered on this line:
Usage = retail_ProductsTableAdapter.Update(changes);
The reason would be that changes is null . Which means that stocktrackerDataSet.GetChanges() returned null .
I'm therefore guessing further that GetChanges is either broken or is supposed to return null if there are no changes. If it is the latter then the solution is to check if changes is null, and if not then pass the changes through to the database.
|
|
|
|
|
i want to execute file.exe from resource how can i do ?
pls give me code or pls upload sample project
Thanks
|
|
|
|
|
wtf [HELP ME] ??? I guess its 'urgent', too, right ???
why dont you
1) learn to be polite
2) learn how to use google
3) come back when you have some code you'd like to discuss
'g'
|
|
|
|
|
hi i am uploading file using ftp the file is uploaded successfully but the reason is that their is no data in it it shows zero(0) bytes. so plz help
|
|
|
|
|
Unless you are doing this with C#, I think this is the wrong board for this question...
|
|
|
|
|
I'm trying to optimize a bit of coding and trying to decide if there's a better way to retrieve a list of paired values. Right now I'm just adding the values to a string and using split to pull them out after the list is made.
The question is, would it be faster to use a list, array or some other collection rather than a string for a randomly sized list of 0 to 24 elements. Each element is a pair of single digit numbers.
Normally I wouldn't worry about something so trivial, however this piece of code will end up looping a few million times.
The true man wants two things: danger and play. For that reason he wants woman, as the most dangerous plaything.
|
|
|
|
|
|
nice find Mia - I'll remember that
|
|
|
|
|
Like very wow, great link. Thanks much Gonna take a while to digest it all, but I found some great tips I can use now.
The true man wants two things: danger and play. For that reason he wants woman, as the most dangerous plaything.
|
|
|
|
|
Hi,
if the data initially are numbers, not strings, then don't use strings.
if the first numbers of all pairs have different values, you have two choices:
- the generic Dictionary < int, int > since it stores pairs of numbers, be warned it does not preserve order.
- or, since the range is very limited, have a 10-element array and choose a special value to indicate absence of a pair.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
I thought of those, that's why I was asking if someone had more info on their performance. If I use an array, I have to add in code to check what the last used element was, in order to add new values on to the end. If I use a collection (ordering isn't important for the data) then I have the overhead of a linked list. With the string being essentially an array of char[] I was pretty sure it would come down to either the string or just an array if there was enough overhead removal to warrant the code change.
From the link I was given, it looks like that fastest way to go is going to be a 48 element array. Since I'm only dealing with at most 4 of them at a time, they should stay in cache. I only have to keep track of how many elements are there during the adding process to prevent having to scan the array before every addition. For reading I have an easy cheat, since 0 isn't a valid value, I'll know when I hit the last element.
What I think will also help out a lot is some restructuring of the class that's being worked with to produce the number lists in the first place. It's a small class to begin with and I think I can reduce it down to a value type struct, by moving the functions into the container class. If all goes well, the whole mess should fold up into cache with a bit of room to spare. Then it should just come down to figuring out how many sets I can queue up from the database at a time.
The true man wants two things: danger and play. For that reason he wants woman, as the most dangerous plaything.
|
|
|
|
|
when i Start to create the Project first i did little mess and try some experiment with MS SQL.
Now I working with MYSQL... any way when i publish the project the set file looking for this:
The following prerequisites are required:
* Windows Installer 3.1
* .NET Framework 3.5 SP1
* SQL Server Compact 3.5
* Windows Installer 4.5
* SQL Server 2008 Express Edition
How can i remove the relationship with the these SQL components that i really don't need???
|
|
|
|
|
clean out your references and check your prerequisites in the project properties.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hello,
I'm having a very strange problem within c# that when I attempt to
query for the list of ReplicationGroupName in DFS, I do not receive
any information; however when I run the same query using WMIC, I get
results.
Here is my c# code ("TargetMachine" being a DFS member server)
System.Management.ManagementScope oMs = new
System.Management.ManagementScope("\\\\" + TargetMachine + "\\root\\microsoftdfs");
oMs.Connect();
System.Management.ObjectQuery oQuery = newSystem.Management.ObjectQuery("SELECT ReplicationGroupName FROM DfsrReplicationGroupConfig");
ManagementObjectSearcher oSearcher = new ManagementObjectSearcher(oMs, oQuery);
foreach (var item in oSearcher.Get())
{
MessageBox.Show(item.ToString());
}
The following works:
WMIC /node:"dynamic-dc01" /namespace:\\root\microsoftdfs path DfsrReplicationGroupConfig get ReplicationGroupName
Why would the C# code not work?
Thanks very much,
Matt Brown
|
|
|
|
|
bump
|
|
|
|
|
hi
how to carry textbox pointer forward or back ?
thanks
|
|
|
|
|
If you're referring to the cursor, you can use the arrow keys. If you want to do it programmatically, then set the SelectionStart and SelectionLength properties
|
|
|
|
|
thanks a lot
i forgot arrow keys i think only selectionstart and selectionlength
|
|
|
|
|
how a dataset can transfer from server to client using socket programming in C#. Is it possible?
|
|
|
|
|
Create a NetworkStream between the two computers and serialise the DataSet across it. Use a CryptoStream if you need security
|
|
|
|
|
Please send some example code related to this.
|
|
|
|
|
http://msdn.microsoft.com/en-us/library/system.net.sockets.networkstream.aspx
|
|
|
|
|
If I do that, you won't learn from it. The most that you will get out of me is some pseudo-code
Client
Start listening on port x
Set up a background thread. When you receive data, use TcpClient.GetStream to get the NetworkStream
Deserialise the NetworkStream into a DataSet
Close the NetworkStream and TcpClient
Server
Accept an IP address
Try to connect to the IP address, on port x (this is the same port as the client)
When you have connected, simply use the same TcpClient.GetStream method as a data sink. Serialise the DataSet into this Stream
Close the NetworkStream and TcpClient
If you really wanted to, you could make this more complex (status codes, etc), but that's the basic gist of it. If you need code, then search Google for a simple chat application (this gets you the basic infrastructure) and serialisation (this will cover the transfer of the DataSet)
|
|
|
|