Thursday, 21 December 2006
After so long..
Today I found one nice link which used to bind 2d array to datagrid.
http://www.codeproject.com/cs/database/BindArrayGrid.asp
Today started looking at .NET 3.0 for new project.
Here is nice link for the same.
http://www.netfx3.com/
Monday, 18 December 2006
Comments on article.
for me and I started searching on msdn2. Surprisingly I came to know that Microsoft does not recommend to derive custom exception classes from System.ApplicationException rarther is says that you should derive it directly from System.Exception. In .NET 1.1 it was exactly reverse. But this approach does not add significant value addition.
Here is link from MSDN2.
http://msdn2.microsoft.com/en-us/library/ms229005.aspx
While browsing this link I was really amazed to see so much of information. I am trying to make it at one place..
There are many good articles on usage on msdn2.
Some of them are like..
Guidelines for Names:
http://msdn2.microsoft.com/en-us/library/ms229002.aspx
Type Design Guidelines:
http://msdn2.microsoft.com/en-us/library/ms229036.aspx
Member Design Guidelines:
http://msdn2.microsoft.com/en-us/library/ms229059.aspx
Designing for Extensibility:
http://msdn2.microsoft.com/en-us/library/ms229028.aspx
Usage Guidelines:
http://msdn2.microsoft.com/en-us/library/ms229035.aspx
.NET Framework Class Library Reference:
http://msdn2.microsoft.com/en-us/library/d11h6832(VS.80).aspx
Asynchronous Programming Design Patterns:
http://msdn2.microsoft.com/en-us/library/ms228969.aspx
These are too good articles and everyone should read to expand their knowledgebase.
Friday, 15 December 2006
My .NET Articles...
sites like
www.codeguru.com, www.codeproject.com.
Here are those links.
- http://www.codeguru.com/csharp/csharp/cs_syntax/errorhandling/article.php/c12971/
- http://www.codeguru.com/csharp/.net/net_general/eventsanddelegates/article.php/c12933/
- http://www.codeguru.com/csharp/.net/net_general/tipstricks/article.php/c11367/
- http://www.codeguru.com/csharp/csharp/cs_syntax/inheritance/article.php/c10215/
- http://www.codeproject.com/Purgatory/NET_remoting_in_chat_app.asp
- http://www.codeproject.com/useritems/Events_and_Delegates.asp
- http://www.codeproject.com/useritems/Satellite_assemblies.asp
- http://www.csharphelp.com/archives2/archive438.html
Will keep on putting more articles.
Some inspirational links I found...
http://quotations.about.com/cs/inspirationquotes/a/Success1.htm
For SQL server questions...
Add, edit, delete datagridview.
After so many days. I was busy with Sister-In-Law's marriage. Yesterday I was not able to login. Something wierd was happening. Yesterday I was fignting with simple datagridview to add, edit and delete operations. I was able to to add and edit but delete? It took me 3-4 hours to make it work anf finally I did it. The following link helped me.
http://msdn2.microsoft.com/en-us/library/5s3ce6k8.aspx
It was simple thing to do but I was trying it with datatable. But actually you can do it with
public partial class Form1 : Form
{
private const string connectionString = "Database=MyDatabase;Server=localhost;User=sa;Password=sa;Enlist=false;";
private string sqlQuery;
private SqlConnection connection;
private SqlCommand command;
private SqlDataAdapter adapter;
private SqlCommandBuilder builder;
private DataSet ds;
private DataTable userTable;
private string[] fields = { "StatusId", "ADUserId", "Email", "FirstName",
"LastName" , "JobTitle", "DepartmentId", "Phone", "Fax",
"Mobile", "UniqueKey", "IsDeleted", "CreatedByUserId", "CreatedOn",
"ModifiedByUserId" };
public Form1()
{
InitializeComponent();
SetDataObjects();
btnUpdate.Enabled = false;
}
private void SetDataObjects()
{
sqlQuery = "SELECT UserID, StatusId, ADUserId, Email, FirstName, LastName, "
+ " JobTitle, DepartmentId, Phone, Fax, Mobile, UniqueKey,"
+ " IsDeleted, CreatedByUserId, CreatedOn, ModifiedByUserId"
+ " FROM [User]";
connection = new SqlConnection(connectionString);
command = new SqlCommand(sqlQuery, connection);
adapter = new SqlDataAdapter(command);
builder = new SqlCommandBuilder(adapter);
ds = new DataSet("MainDataSet");
}
private void btnLoad_Click(object sender, EventArgs e)
{
btnLoad.Enabled = false;
try
{
if (userTable != null)
{
userTable.Clear();
}
userDataGridView.DataSource = null;
userDataGridView.Rows.Clear();
userDataGridView.Refresh();
connection.Open();
adapter.Fill(ds, "User");
userTable = ds.Tables["User"];
foreach (string field in fields)
{
DataGridViewTextBoxColumn column = new DataGridViewTextBoxColumn();
column.AutoSizeMode = DataGridViewAutoSizeColumnMode.ColumnHeader;
column.ValueType = userTable.Rows[0][field].GetType();
column.DataPropertyName = field;
column.HeaderText = field.ToUpper();
column.Name = field;
column.ReadOnly = false;
column.SortMode = DataGridViewColumnSortMode.Automatic;
column.Visible = true;
switch (field.ToLower())
{
case "aduserid":
case "email":
case "firstname":
case "lastname":
case "jobtitle":
case "departmentid":
case "phone":
case "fax":
case "mobile":
break;
case "statusid":
userTable.Columns[field].DefaultValue = 1;
column.Visible = false;
break;
case "userid":
column.Visible = false;
break;
case "uniquekey":
userTable.Columns[field].DefaultValue = 1;
column.Visible = false;
break;
case "isdeleted":
userTable.Columns[field].DefaultValue = 0;
column.Visible = false;
break;
case "createdbyuserid":
userTable.Columns[field].DefaultValue = 1;
column.Visible = false;
break;
case "createdon":
userTable.Columns[field].DefaultValue = DateTime.Now;
column.Visible = false;
break;
case "modifiedbyuserid":
userTable.Columns[field].DefaultValue = 1;
column.Visible = false;
break;
}
userDataGridView.Columns.Add(column);
}
userDataGridView.DataSource = userTable.DefaultView;
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
btnLoad.Enabled = true;
}
finally
{
connection.Close();
}
}
private void btnAdd_Click(object sender, EventArgs e)
{
try
{
userDataGridView.ReadOnly = false;
btnAdd.Enabled = false;
btnUpdate.Enabled = true;
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
private void btnUpdate_Click(object sender, EventArgs e)
{
try
{
connection.Open();
adapter.Update(userTable);
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
finally
{
btnAdd.Enabled = true;
btnLoad.Enabled = true;
btnUpdate.Enabled = true;
connection.Close();
}
}// Was simeple but I took little bit more time.
private void btnDelete_Click(object sender, EventArgs e)
{
if (MessageBox.Show("Do you really want to delete selected record(s)?",
"Delete Warning", MessageBoxButtons.YesNo,
MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2, 0, false)
== DialogResult.Yes)
{
try
{
connection.Open();
int cnt = userDataGridView.SelectedRows.Count;
for (int i = 0; i <> 0 &&
this.userDataGridView.SelectedRows[0].Index !=
this.userDataGridView.Rows.Count - 1)
{
this.userDataGridView.Rows.RemoveAt(
this.userDataGridView.SelectedRows[0].Index);
}
}
adapter.Update(userTable);
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
finally
{
connection.Close();
btnLoad.Enabled = true;
}
}
}
}
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. "
Friday, 1 December 2006
Rapidigm became Microsoft Gold Partner
Today I have submitted article on events and delegates on codeproject and codeguru. Folowing is the link on codeproject and codeguru people will review it and approve it.
http://www.codeproject.com/useritems/Events_and_Delegates.asp
Wednesday, 29 November 2006
Link using which u can log in to yahoo, msn messegner -> https://www33.meebo.com/index-en.html
Online gogle earth: http://www.wikimapia.org/#y=25000000&x=10000000&z=2&l=0&m=a
Enjoy..
Marathi nice links
- www.maayboli.com
- www.marathiworld.com
- www.tukaram.com
- http://www.maayboli.com/hitguj/messages/58489/58786.html?1162589393
- www.marathitaraka.com
- www.vskhandekar.com
- www.gadima.com
- www.chintoo.com
- http://www.chhatrapati-shivaji.com/
- www.tuljabhavani.com
Will be adding many more as I come across..
- Asynchronous Code Blocks http://www.codeproject.com/cs/library/AsynchronousCodeBlocks.asp
- Camera Vision - video surveillance on C# http://www.codeproject.com/cs/media/cameraviewer.asp
- An Introduction to AJAX Techniques and Frameworks for ASP.NET http://www.codeproject.com/Ajax/IntroAjaxASPNET.asp
- List on codeproject http://www.codeproject.com/script/competitions/monthly/winners.asp
Tuesday, 28 November 2006
Today I visited some of nice stuff on .NET serialization. Here are some links that might be helpful to anybody.
- .NET serialization -> http://www.codeproject.com/csharp/objserial.asp
- Using report viewer control in ASP.NET 2.0 -> http://www.gotreportviewer.com/
- Preventing Duplicate Record Insertion or Page Refresh on postback of a Web Form -> http://www.codeproject.com/aspnet/formKeyManager.asp
- Arrays in .NET -> http://msdn2.microsoft.com/en-us/library/aa302316.aspx
- Shallow copy Vs. Deep copy -> http://www.thescripts.com/forum/thread269691.html
- Strings in .NET -> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnguinet/html/drguinet5_update.asp
- Windows impersonation in ASP.NET -> http://www.ftponline.com/vsm/2004_05/magazine/columns/qa/
- C# interview questions -> http://www.techinterviews.com/?p=153
I'll keep on posting nice links as I come across any. You also can contribute by posting the links you liked.
Monday, 27 November 2006
Hi!! First message from Jayant
This is my first message on this blog. I am a .NET professional from Pune, India and working as a Sr. Systems Executive with Rapidigm - A Fujitsu Consulting Company. I am looking for .NET 2.0 certification and will like to do discussions on this blog.








