Showing posts with label resolve. Show all posts
Showing posts with label resolve. Show all posts

Friday, March 30, 2012

How can I resolve this database error, in VS 2005?

Every time I try to add a new row to my table, i get this error which i don't now what it means and how i can correct it, could you please advice. i am using VS 2005 and VB Language

**************The error message

"No row was updated.

The data in row 2 was not committed.

Error source:mscorlib.

Error Message: Index was out of range. Must be non-negative and less than the size of the collection.

Parameter name: index"

What code are you using to add the row?

This is the basic VB syntax

Dim myNewRow as DataRow

myNewRow=MyDataTable.NewRow()

|||

Yep. What kind of table? A table in a sql server database, or a datatable, which is a .net class?

|||

i am using sql server database

Friday, March 9, 2012

How can I insert a column into a table before another column via T-SQL?

Please, who can help me to resolve this problem?
My database is MS SQL 2000...
Thank you very much!!There is only one way to do this - recreate table. If your table is very big - just use DTS to export and import data.

BEGIN TRANSACTION
CREATE TABLE dbo.Tmp_t2
(
id int NULL,
newcolumn int NULL,
code varchar(10) NULL
) ON [PRIMARY]
GO
IF EXISTS(SELECT * FROM dbo.t2)
EXEC('INSERT INTO dbo.Tmp_t2 (id, code)
SELECT id, code FROM dbo.t2 TABLOCKX')
GO
DROP TABLE dbo.t2
GO
EXECUTE sp_rename 'dbo.Tmp_t2', 't2', 'OBJECT'
GO
COMMIT|||Thanks for your reply, first!!

This way I had think before.

But, I think that the Enterprise Manager can do this in SQL 2000 visual tool.

So.....Maybe somthing can help us to complete this task.

I hope so.....|||Open your table in design mode through Enterprise Manager, then make the change you want but do not close the window or save your changes.

Instead, click on the scripting icon (3rd from left on my toolbar), and then copy the script it creates.

Close your table without saving the changes, and then you can adapt the script you copied to whatever you need.

blindman|||Originally posted by Richard Chen
Thanks for your reply, first!!

This way I had think before.

But, I think that the Enterprise Manager can do this in SQL 2000 visual tool.

So.....Maybe somthing can help us to complete this task.

I hope so.....

Enterprise Manager does the same way. To be honest I took script from EI - in design table click on icon 'Save change script' (third from the left) after some changes done.|||Plagiarist!|||Originally posted by blindman
Plagiarist!

Idea was in air!|||Originally posted by blindman
:D

I just moved from KY (I had an offer from OH, but in MD is much better).|||Now I understand what you said.

It's so kind of you.

I'II try it right now!!