Friday, 8 December 2006
Adding knowledge links
ADO.NET and data persistent framework:
http://www.adapdev.com/downloads/WIDNUG-0511.ppt#1
Tackle Data Concurrency Exceptions Using the DataSet Object:
http://msdn.microsoft.com/msdnmag/issues/03/04/DataConcurrency/
Fighting with SqlDataAdapter.
Yesteray, I was relpying one forum on codeguru. That guys asked me the code. How to add a row to a datatable and how to reflect the changes back to datasource. I was trying a lot to get it done. Searched many sites but I was not able to do it. http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q310347
One of my friend who is SQL MCP came for tea and he also got involved in the same. We tried with SQL profiler. Came to know that when I call dataAdapter.Update(ds); database was not getting hit. Again we searched a lot an then we followed these steps.
- Remove all rows from table which is populated from dataset filled by adapter.
- Add a row with values.
- Call update.
This worked well but we were loosing all data. So AcceptChanges() method helped us. I was using this method after adding a row. This makes the impression that eveything is fine and no need to hit database. So what we did is create a new row, add values to respective columns, then call AccpetChanges() for dataset and datatable and then call AddRow() and then adapter.Update..
husssssh.. it worked at last.. Was happy to see that.
Here is the sample code.
string sqlQuery = "SELECT StatusId, ADUserId, Email, FirstName, LastName, JobTitle, DepartmentId, Phone, Fax, Mobile, UniqueKey, IsDeleted, CreatedByUserId, CreatedOn, ModifiedByUserId FROM [User]";
string connectionString = "Database=DbUsers;Server=localhost;User=user;Password=pwd;Enlist=false;";SqlCommand cmd;
SqlDataAdapter adpt;
DataSet ds = new DataSet();
using (SqlConnection conn = new SqlConnection(connectionString))
{
conn.Open();
cmd = new SqlCommand(sqlQuery, conn);
cmd.CommandType = CommandType.Text;
adpt = new SqlDataAdapter(cmd);
SqlCommandBuilder builder = new SqlCommandBuilder(adpt);
adpt.Fill(ds, "User");
if (ds.Tables[0].Rows.Count > 0)
{ DataRow row = ds.Tables["User"].NewRow();
row["StatusId"] = 1;
row["ADUserId"] = 5;
row["Email"] = jayantdotnet@gmail.com;
row["FirstName"] = "Jayant";
row["LastName"] = "Kulkarni";
row["JobTitle"] = "Chief Architect";
row["DepartmentId"] = 1;
row["Phone"] = "12334";
row["Fax"] = "122333";
row["Mobile"] = "22314234";
row["UniqueKey"] = 120;
row["IsDeleted"] = 0;
row["CreatedByUserId"] = 1;
row["CreatedOn"] = DateTime.Now;
row["ModifiedByUserId"] = 1;
ds.Tables["User"].AcceptChanges();
ds.AcceptChanges();
ds.Tables["User"].Rows.Add(row);
adpt.Update(ds.Tables["User"]);
}
}
Thursday, 7 December 2006
Marathi nice links
http://groups.yahoo.com/group/prashant_n_mhatre/files/
Marathi articles....
.NET links and some other stuff...
Here are the links.
http://msdn.microsoft.com/msdnmag/issues/06/03/TestRun/#bottom.
http://www.codeproject.com/csharp/sdilreader.asp
Excellent link for getting connection strings to different databases.
http://www.connectionstrings.com/
For BizTalk people, here are samples available.
http://www.biztalkgurus.com/biztalk-server-2006.aspx
From microsoft, there is virtual lab at this location.
https://www.microsoft.com/resources/virtuallabs/step3-msdn.aspx?LabID=e423099b-b71b-44f6-bd63-b11170f1e0cf&CID=110834&Token=D0Brd6OxTtLrB9Ts6R8n08_MUvNvOT7w&DB=1
You will need to register with your passport.
There is online telephone directory of BSNL. Visit... http://www.bsnl.co.in/onlinedirectory.htm
Imagine if people all over the world mobilized to replace one billion standard incandescent light bulbs with energy-efficient compact fluorescent (CFL) light bulbs. What would that mean? It would mean that those people would save money each month on their electricity bill. It would mean they would save enough energy to light tens of millions of homes for a year. It would mean the prevention of greenhouse gases equivalent to the annual emissions of millions of cars.
visit: http://www.onebillionbulbs.com/Stats/Country/IN
Tuesday, 5 December 2006
http://en.wikipedia.org/wiki/.NET_Framework.
LEaving for day now. Tomorrow will try to get more articles.
Monday, 4 December 2006
Nice quotes I found on net.
Do not think that you are on the right road just because it is a well-beaten path.
The supreme happiness of life is the conviction of being loved for yourself, or, more correctly, being loved in spite of yourself. - Victor Hugo
Insomuch as any one pushes you nearer to God, he or she is your friend.
Love is the only force capable of transforming an enemy into a friend. - Martin Luther King
You can always tell a real friend; when you've made a fool of yourself, he doesn't feel you've done a permanent job. - Lawrence J. Peter
Love is like a Violin. The music may stop now and then, but the strings remain forever.
If you would be loved, love and be lovable. - Benjamin Franklin
When you were born, you cried and the world rejoiced. Live your life in such a manner that when you die the world cries and you rejoice.
Do good to thy friend to keep him, to thy enemy to gain him. - Benjamin Franklin
No one is so rich that he does not need another's help; no one so poor as not to be useful in some way to his fellow man... - Pope Leo XIII
I no doubt deserve my enemies, but I don't believe I deserved my friends. - Walt Whitman
You can make more friends in two months by becoming interested in other people then you can in two years by trying to get other people interested in you. - Dale Carnegie
He who walks in when others walk out is a true friend.
It takes less time to do a thing right then it then it does to explain why you did it wrong. - H.W. Longfellow
We are silent at the beginning of the day because God should have the first word, and we are silent before going to sleep because the last word also belongs to God. - Dietrich Bonhoeffer
It's no use crying over spilt milk: It only makes it salty for the cat.
The optimist proclaims that we live in the best of all passable worlds; and the pessimist fears this is true. - Branch Cabell
Death is not a period but a comma in the story of life.
Most people are bothered by those passages of scripture they don't understand, but the passages that bother me are those I do understand. - Mark Twain
When arguing with a fool, be sure he isn't doing the same thing.
N.A.S.A. reports galaxies are speeding away from Earth at 90,000 miles per second. What do you suppose the know that we don't?
Most people want to serve God, but only in a advisory capacity.
Depend on the rabbits foot if you will, but remember it didn't work for the rabbit. - R.E. Shay
Courage is fear that has said its prayers.
A positive attitude may not solve all your problems, but it will annoy enough people to make it worth the effort. - Herm Albright
When you cannot get to sleep, talk to the Shepherd, instead of counting sheep.
Don't be afraid to ask dumb questions their easier to handle then dumb mistakes.
You can give without loving but you can't love without giving.
The nice part about being a pessimist is that you are constantly being either proven right or pleasantly surprised. - George Will
God Promises a safe landing, but not a calm passage.
Work for the Lord, the pay isn't much but the retirement is out of this world
The truth of the matter is that you always know the right thing to do the hard part is doing it. - General H. Norman Schwarzkopf
Earth has no sorrow that heaven can not heal. - Thomas Moore
Some of the world's greatest feats were accomplished by people not smart enough to know they were impossible. - Doug Larson
Please be patient -- God isn't finished with me yet.
When tempted to fight fire with fire, remember that the Fire Department usually uses water.
Jesus paid a dept he didn't owe because we had a dept we couldn't pay.
Without deep reflection one knows from daily life that one exists for other people. - Albert Einstein
I've never been poor, only broke. Being poor is a frame of mind. Being broke is a temporary situation.
A sinning man will stop praying. A praying man will stop sinning.
When God allows a burden to be put upon you, He will put His arms underneath you to help you carry it.
The greatest trick the Devil ever pulled was convincing the world that he didn't exist.
Don't ever slam a door- you may want to go back.
What you do when you don't have to do it will determine what you are when it's too late to do anything about it!
Before you point your fingers be sure your hands are clean.
The next time the devil reminds you of your past, remind him of his future.
For God is not against us because of our sin. He is with us; against our sin.
Your worst days are never so bad that you are beyond the reach of God's grace. And your best days are never so good that you are beyond the need of God's grace. - Jerry Bridges
God can mend a broken heart but he must have all the pieces.
Don't tell God how big your problems are...tell your problems how big your God is.
The Word of God will keep you from sin, or sin will keep you from the Word of God.
- The Standalone Programmer: Tips from the trenches :http://www.codeproject.com/gen/work/standaloneprogrammer.asp
- Understanding Classic COM Interoperability With .NET Applications: http://www.codeproject.com/dotnet/cominterop.asp
- Strong Names Explained: http://www.codeproject.com/dotnet/StrongNameExplained.asp
- Using CodeDom for creating and compiling dynamic assemblies. http://msdn2.microsoft.com/en-gb/library/system.codedom.codemembermethod.aspx http://www.c-sharpcorner.com/Code/2005/May/DynamicCreatingAppl.asp
An excellent article on parameters passing in C#.
http://www.yoda.arachsys.com/csharp/parameters.html
Very important sentence on this page: "This difference is absolutely crucial to understanding parameter passing in C#, and is why I believe it is highly confusing to say that objects are passed by reference by default instead of the correct statement that object references are passed by value by default. "








