Considering your code and you want to comment a block of code using your keyboard!!
Well...no worries...
Select the code you want to comment
Press Ctrl + K + C
to Uncomment the code
Press Ctrl + K + U
Unfortunately unlike eclipse it dosent use the same shortcut to comment and uncomment the code.
Another good editing shortcut:
Have you ever tried to delete a line, and then started to use backspaces or del keys to format the code?
Well...if you do want to remove the line completely....even without selecting the whole line
press Shift + Del and the line will dissapear without affecting anything else
Collapse all Regions / Blocks
Ctrl + M + O
some good shortcuts given at http://visualstudiohacks.com/navtricks
Tuesday, August 28, 2007
Wednesday, August 22, 2007
Can't connect to remote sql server/express?
Got a few links that can help.
Make sure that you check the log file in the server's directory, to find the nature of the error.
this blog gives a brief description of the protocol errors:
http://blogs.msdn.com/sql_protocols/archive/2006/02/21/536201.aspx
if you are not able to connect to the server, follow the steps given in
http://blogs.msdn.com/sql_protocols/archive/2007/05/13/sql-network-interfaces-error-26-error-locating-server-instance-specified.aspx
And if your client is Vista, turn off the firewall.. that will solve the issue, Im trying to find how to enable the firewall and still connect to the DB.
Will update accordingly,
Goood luck
Make sure that you check the log file in the server's directory, to find the nature of the error.
this blog gives a brief description of the protocol errors:
http://blogs.msdn.com/sql_protocols/archive/2006/02/21/536201.aspx
if you are not able to connect to the server, follow the steps given in
http://blogs.msdn.com/sql_protocols/archive/2007/05/13/sql-network-interfaces-error-26-error-locating-server-instance-specified.aspx
And if your client is Vista, turn off the firewall.. that will solve the issue, Im trying to find how to enable the firewall and still connect to the DB.
Will update accordingly,
Goood luck
Sunday, August 19, 2007
Concurrency violation: the UpdateCommand affected 0 of the expected 1 records
{"Concurrency violation: the UpdateCommand affected 0 of the expected 1 records."}
Terrible exception.
Well what was happening is i had a datatable, and i was editing it.
At one of the points i update it, then I call in a different class's method, pass only the unique key of one of the rows and make certain claculations, change the row, and update it.
Now when I go back to my original table, and update it....it threw this error.
Lets take this example.
The table "myTable" has the following fields: ID,name,address,country,credit
where ID is the primary key.
lets take a row ID=1,name=Shashi,address=Brisbane,country=Australia,credit = 20
i have 2 classes MyClass and MyCalcClass
MyClass is instantiated and it acquires a row from myTable lets call it myRow
now i instantiate an instance of MyCalcClass called objCalc and send it myRow.ID.
now objCalc changes the value of credit (lets say multiplies by 10) to 200 from 20 and saves it.
now back in MyClass if i save myRow.
The adapter throws back with the error.... why?
well....for ID=1 the credit value shud have originally been 20 but it dosent find it..and hence it throws a concurrency error
to overcome this.....either send the entire row so that the row is update while objCalc does its changes ,OR: repopulate myRow for that ID so that you have the latest updated version of the row.
Eureka, it worked for me
Terrible exception.
Well what was happening is i had a datatable, and i was editing it.
At one of the points i update it, then I call in a different class's method, pass only the unique key of one of the rows and make certain claculations, change the row, and update it.
Now when I go back to my original table, and update it....it threw this error.
Lets take this example.
The table "myTable" has the following fields: ID,name,address,country,credit
where ID is the primary key.
lets take a row ID=1,name=Shashi,address=Brisbane,country=Australia,credit = 20
i have 2 classes MyClass and MyCalcClass
MyClass is instantiated and it acquires a row from myTable lets call it myRow
now i instantiate an instance of MyCalcClass called objCalc and send it myRow.ID.
now objCalc changes the value of credit (lets say multiplies by 10) to 200 from 20 and saves it.
now back in MyClass if i save myRow.
The adapter throws back with the error.... why?
well....for ID=1 the credit value shud have originally been 20 but it dosent find it..and hence it throws a concurrency error
to overcome this.....either send the entire row so that the row is update while objCalc does its changes ,OR: repopulate myRow for that ID so that you have the latest updated version of the row.
Eureka, it worked for me
Subscribe to:
Posts (Atom)
