|
Or you could also look here:
C# graph code
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
Christian Graus wrote:
C# graph code
That's even worse than John Simmons link.
-Nick Parker
DeveloperNotes.com
|
|
|
|
|
Three posts in three days, all from new accounts, all who have posted only one question - the same question. Give me a break.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
Enlighten me, Nick!
As for Christian's link, I'll definitely be waiting to pounce on Bjarke with that one at work!
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
|
Yeah, Christian's is much better!
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
That's the damn funniest thing I've seen / heard in weeks - even more than my MIS cracks I dish-out to Nick Parker! I definitely have to remember that...
I agree with your sentiments entirely (and your more-than-adequate comments are much shorter than my jabs - I guess I should take note...and use that very same link).
People who post such blatently stupid questions don't even bother to google the 'net or search CP, it's no suprise they don't search the SDK documentation (.NET, Platform SDK, whatever). Too many people in this field think the ability to write "hello, world" apps makes them a developer!
Thanks for the hilarious link! I'll be sure to throw that one in after I'm tired of stupid questions, too.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Heath Stewart wrote:
even more than my MIS cracks I dish-out to Nick Parker!
You have to stop grouping me with the other M.I.S. students that work there.
-Nick Parker
DeveloperNotes.com
|
|
|
|
|
Heath Stewart wrote:
People who post such blatently stupid questions don't even bother to google the 'net or search CP,
Especially as when we needed something similar we found a freeware library in minutes with google !!!
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
|
Well, I unfortunately don't have the book (although I am currently keeping watch for one for under $15 on Ebay), so I'm not that familiar with its contents. I've looked at the TOC on Amazon.com, though.
But I'll let you know if I find something that needs coverage that I don't think you've covered.
|
|
|
|
|
|
Why does your name sound sooo familiar???
/\ |_ E X E GG
|
|
|
|
|
|
|
|
Tom,
I just read your reply, however I have not received a notification yet via email that a reply was posted. I'll keep watching in case it just hasn't passed through all the wires yet.
-Nick Parker
DeveloperNotes.com
|
|
|
|
|
Do we get a free copy for responding
|
|
|
|
|
As many people feel that authors don't cover enough of the issues that need to be addressed, I thought I'd give people here a chance to make sure that the topics of their interest are included in the book.
And what better place to offer that chance than on a site where people come when they can't find answers in current books
Cheers,
Tom Archer
Never be afraid to try something new. Remember that a lone amateur built the Ark. A large group of professionals built the Titanic.
* Inside C# -Second Edition
* Visual C++.NET Bible
* Extending MFC Applications with the .NET Framework
|
|
|
|
|
You are truely an author for the people.;)
|
|
|
|
|
|
(my post from Tom's forum copied here for the benefit of Code Project users)
Tom,
I would like to see a C# book with more coverage of the following issues:
1. Performance. For example, an expansion of the stuff in Jan Gray's article (http://msdn.microsoft.com/library/?url=/library/en-us/dndotnet/html/fastmanagedcode.asp) would be excellent! Also have a look at the topics in the dotnet framework performance newsgroup and hit on some of those.
2. Threading and async delegate calls, in depth! Top to bottom, beginning to end, easy to hard.
3. I'm waiting on the equivalent of Scott Myers's "Effective C++" books for C#, so the more such tips you can include, the better!
4. As a continuation of #3, I'd like to see a bit about lazy evaluation in C#. For example, I often use a property that creates the object on demand, and I'd like to find more similar tricks.
5. More on code generation.
6. More on how the C# compiler works.
7. LOTS on generics! This will be exciting.
I'm looking forward to your book and the new laguage features!
|
|
|
|
|
This is probably a dumb question, but I'm trying to figure out how to add a row to an SQL table using C# -- without having to create a messy INSERT command.
For example, in ASP/JScript I can do something like this:
con = Server.CreateObject( "ADODB.Connection" );
con.Open( "CONNECT_STRING" );
rs = Server.CreateObject( "ADODB.Recordset" );
rs.CursorLocation = adUseClient;
rs.Open( "TABLE_NAME", con, adOpenKeyset, adLockOptimistic, adCmdTable );
rs.AddNew();
rs( "COLUMN_NAME" ) = COLUMN_VALUE;
rs( "COLUMN_NAME" ) = COLUMN_VALUE;
... etc ...
rs.Update();
rs.Close();
con.Close(); In C++, using these ADO classes[^], I can do something like this:
CADODatabase db;
if( db.Open( "CONNECT_STRING" )
{
CADORecordSet rs( &db );
if( rs.Open( "TABLE_NAME", CADORecordSet::openTable ) )
{
rs.AddNew();
rs.SetFieldValue( "COLUMN_NAME", COLUMN_VALUE );
rs.SetFieldValue( "COLUMN_NAME", COLUMN_VALUE );
... etc ...
rs.Update();
rs.Close();
}
db.Close();
} I'm trying to learn how to do this in C#, and I've got this so far (okay, not much):
SqlConnection sql = new SqlConnection( "CONNECT_STRING" );
SqlCommand cmd = new SqlCommand( "COMMAND", sql );
cmd.ExecuteNonQuery(); I assume this would work, but as mentioned, I don't want to be burdened with creating a huge complicated INSERT command or escaping the ' character in fields. I'd rather just set the individual fields to some sort of object (like I've done with ADO Recordset in the past) and then use that to add a row to the table.
Can anyone point me in the right direction? Any idea what classes I need to use to do this? Or a rough overview of the procedure?
|
|
|
|
|
You're not using the SQL statements correctly in .NET if you think INSERTs (or any other command) is hard. Take a look at the documentation for SqlParameter and SqlCommand.Parameters . You don't have to worry about properly escaping param values and can work with input, output, and return params with no problem:
SqlConnection conn = new SqlConnection(connectionString);
try
{
SqlCommand cmd = conn.CreateCommand();
cmd.CommandText = "INSERT INTO MyTable (ID, Name, Birthday) " +
"VALUES(@ID, @Name, @Birthday)";
cmd.Parameters.Add("@ID", SqlDbType.Int);
cmd.Parameters.Add("@Name", SqlDbType.NVarChar, 40);
cmd.Parameters.Add("@Birthday", SqlDbType.DateTime);
string[] names = new string[] {"Dad", "Mom", "Brother"};
conn.Open();
for (int i=0; i<names.Length; i++)
{
cmd.Parameters["@ID"].Value = i;
cmd.Parameters["@Name"].Value = names[i];
cmd.Parameters["@Birthday"].Value = DateTime.Now.AddYears(i * -10);
cmd.ExecuteNonQuery();
}
}
finally
{
if (conn != null) conn.Close();
} This is just an example to show you the power of parameterized statements. The same is done with SqlCommand s when using the SqlDataAdapter .
The other way is to create a DataSet , build the schema (or create a strongly-typed DataSet using VS.NET's DataSet designer (or other data designers, like dragging and dropping a table from the connections tab), or the xsd.exe utility), and add rows to that, which you then call SqlDataAdapter.Update , but you'll still need parameterized queries.
This is how ADO.NET works and - if you architect your solution right - can be much better than the old ADO way (for example, DataSet s are very good at tracking changes, dealing with relationships, and even identity columns).
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Thank you! That is exactly what I wanted to know.
|
|
|
|